Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] server launcher + ui #23

Merged
merged 20 commits into from
Jun 23, 2024
Merged

[wip] server launcher + ui #23

merged 20 commits into from
Jun 23, 2024

Conversation

logan-markewich
Copy link
Collaborator

No description provided.

Copy link
Contributor

@nerdai nerdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat to see textual -- it looks very intuitive!

# uvicorn.run(self._app, host=self.host, port=self.port)

class CustomServer(uvicorn.Server):
def install_signal_handlers(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing this was causing us some issues? So we needed to override it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I needed some way to spin up multiple servers, and apparently this is the only way 😅

current_human_tasks = [*self._outstanding_human_tasks]

while len(current_human_tasks) > 0:
task_def = current_human_tasks.pop(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Comment on lines -204 to -209
@asynccontextmanager
async def lifespan(self) -> AsyncGenerator[None, None]:
"""Starts the processing loop when the fastapi app starts."""
asyncio.create_task(self.processing_loop())
yield
self.running = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we don't need lifespan for human service? I see that we also added handle_task endpoint/endpoint-function that is different from the other services as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this means that as server, we want this service to handle task on request (versus listening to the message queue?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea if you think about it as a UI, we don't need any processing loop, it should be fully driven by the api endpoints.

So, since there's no processing loop, I removed the lifespan

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Let me know if I'm off base here, but it seems to work!)

@logan-markewich
Copy link
Collaborator Author

Oops, did I botch tests lol

@nerdai
Copy link
Contributor

nerdai commented Jun 23, 2024

Oops, did I botch tests lol

Haha all good. I can take a look after a quick bite ~15 mins.

@logan-markewich logan-markewich merged commit 42eb7e7 into main Jun 23, 2024
4 of 5 checks passed
nerdai added a commit that referenced this pull request Jul 21, 2024
* initial wip commit

* wip

* reorg

* scaffolding for remote mq

* wip

* wip

* clean up url join

* rename

* start unit test

* add unit tests for simple mq app

* unit test for deregister_consumer

* test get_consumers

* add CLI to package

* make it work?

* make app async

* fix human service processing loop

* lint

---------

Co-authored-by: Andrei Fajardo <[email protected]>
@masci masci deleted the logan/new_server_launcher branch October 23, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants