-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
There was a problem hiding this 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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 😅
agentfile/services/human.py
Outdated
current_human_tasks = [*self._outstanding_human_tasks] | ||
|
||
while len(current_human_tasks) > 0: | ||
task_def = current_human_tasks.pop(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
@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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!)
Oops, did I botch tests lol |
Haha all good. I can take a look after a quick bite ~15 mins. |
* 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]>
No description provided.