-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Run Orion in the background #7057
Conversation
✅ Deploy Preview for prefect-orion ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
Co-authored-by: Michael Adkins <contact@zanie.dev>
@madkinsz I improved the error messages. The following tasks are pending:
If there's anything else let me know. |
CTRL+C doesn't work on Uvicorn for Windows :( |
Tests run on Windows with version:
The |
For now it will not be possible to change the On POSIX systems it can be synchronous but on Windows systems CTRL+C is not sent to the |
Thanks so much for digging into this! To clarify, the broken case here is I thought that the signal handling was fixed by @bunchesofdonald in #6672 but perhaps that doesn't work with the synchronous process implementation? Do you see a clear path to retaining the async process implementation while returning before the process exists? As an alternative, we could retain the async implementation for the blocking case and only use the sync implementation for |
Yup. CTRL+C works in all cases, but on Windows only if the function is asynchronous.
That's right. It was fixed in asynchronous mode. In synchronous mode But there is a problem in uvicorn's implementation of asyncio that is affecting this behavior on Windows. I did the following test: I ran the uvicorn command in the Windows terminal inside the Prefect virtual environment and tried to close it using CTRL+C several times. As it didn't close I had to use the task manager for that.
I did not understand that question.
Yup. I believe this is the best solution until the |
:D by
I mean, can we use the previous async |
Now I get it! :) It is possible by removing the context manager from I agree not to split it into two implementations and follow the AnyIO documentation:
I'll go back to PR for draft and test it that way. |
Now closes #6821 |
I merged the functions and now they have the following purposes:
WindowsThe For detached mode, there is an issue with the We have a few ways to go:
|
Sweet! This is coming along nicely. Regarding Windows, I'm fine with users needing Python 3.10+ to not see the error. Especially since it does not actually impact the server. I'm a little worried about leaving the async resources unclosed on cancellation. This was a big pain for me to fix previously and I do not want regressions. I think we also need async support for the process killing functionality (that is using |
Thank you very much. 😊 Sometimes I think it makes no sense to have a detached process asynchronously 🧐. That would avoid some problems. |
This pull request is stale because it has been open 60 days with no activity. To keep this pull request open remove stale label or comment. |
Summary
Adds
prefect orion start --detach
andprefect orion stop
commands.Closes #6989 and #6821
prefect orion start --detach
:Run Orion in the background. It can also be called using the shortcut
-d
prefect orion start -d Orion running in background. Check out the dashboard at http://127.0.0.1:4200
A PID file is written to the path
~/.prefect/orion.pid
(depending on howPREFECT_HOME
is set) so that it can be stopped.An error is displayed when this file already exists and the
start
command is used:prefect orion stop
:Checks if the file
~/.prefect/orion.pid
(depending on howPREFECT_HOME
is configured) exists and terminates the background Orion process.prefect orion stop Stopping Orion... Orion stopped!
Displays an error if this file does not exist or is invalid. Example:
prefect orion stop Orion is not running in the background.
Checklist
<link to issue>
"fix
,feature
,enhancement