-
Notifications
You must be signed in to change notification settings - Fork 772
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
Prevent idle computer from sleeping while flow is running #2032
Comments
you can already do it today out of the box on mac os - just try executing -
:) |
@savingoyal Yes! I’m aware. However, the responsibility should be on the program to do it so that the user does not need to think about it. For example, if a web browser is currently downloading a file, the user expects idle sleep to be prevented automatically. |
It's a good question if metaflow should interfere with the system settings of the host computer. I am unaware of any other program of a similar nature that hijacks the sleep settings. Regardless, there is always a way out with using solutions like caffeinate. |
Hmm I think there is a misunderstanding here. Let me elaborate.
To be clear, we are not talking about changing the system settings. We are talking about using an official system API to tell the OS to temporarily prevent idle sleep during a long-running operation.
As I mentioned in #2032 (comment), it is common practice for programs to temporarily prevent idle sleep during long-running operations. Examples:
Here are some example command-line programs from this GitHub search:
Yes, this is a good workaround. However, I created this issue because I think Metaflow should automatically prevent idle sleep while running a flow. I imagine the following is a common scenario:
That’s why I think it would be a good default for Metaflow to prevent idle sleep while running a flow. Can you think of any scenarios where the user would not want idle sleep to be prevented while running a flow? |
for long-running workflows there can be other sources of interruptions as well (the machine could crash for any arbitrary reason) - that's why we recommend deploying the flow to step-functions, airflow or argo-workflows to gain an additional factor of resiliency. |
Sure, the computer or Metaflow could crash at any time and the user will have to deal with it. This matches the mental model of the user operating their computer—apps crash all the time, the kernel crashes from time to time, etc. But that same mental model also prescribes that programs with important, long-running operations automatically prevent idle sleep. See the examples I already gave. I’m not sure I understand your concerns about my suggestion. Is there any downside to preventing idle sleep when running a flow locally? |
@fohrloop’s Usage: from wakepy import keep
with keep.running(on_fail='warn'):
# Run the flow here. @savingoyal If you can point me to the code where the |
As far as I can tell, Metaflow does not prevent idle sleep, which means the computer may go to sleep while a long-running flow is still in progress. Instead, Metaflow can use one of various libraries to prevent idle sleep. For example,
caffeine
uses macOS’s system API to prevent idle sleep.The text was updated successfully, but these errors were encountered: