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

Added --stop-at-time and --stop-days arguments #1006

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

schubc
Copy link
Contributor

@schubc schubc commented Jul 26, 2024

This PR introduces two new arguments to the command line interface for nexrender-worker:

--stop-at-time: This parameter allows users to specify a certain local time when the worker will terminate. An example usage would be --stop-at-time=5:00, which will stop the worker at 5 am local time.

--stop-days: This parameter works in conjunction with the --stop-at-time parameter and allows to specify on which weekdays the worker should terminate. The days are represented as numbers where 0 is Sunday and 6 is Saturday. For instance, --stop-days=1,2,3,4,5 will stop the worker at the specified time from Monday through Friday.

This enhancement increases the flexibility of controlling worker runtime and can help schedule tasks more effectively.

Example use:
nexrender-worker-win64.exe --host=http://my-host:3000 --multi-frames --stop-at-time=5:00 --stop-days=1,2,3,4,5
This will stop the worker at 5am from Monday through Friday.

Please review and provide any feedback.

Introduced `--stop-at-time` and `--stop-days` options to allow scheduling worker stops at specific times and on specified weekdays. This enhancement helps manage worker operation times more flexibly, avoiding unwanted runs during off hours or weekends.
Updated the stop-days parameter explanation for better clarity. Indicated that 0 is Sunday and 6 is Saturday, and revised the example to show the correct usage excluding weekends.
Renamed outdated variable 'stopTimeDate' to 'stop_datetime' for better readability and consistency. Added a null check and broke one lengthy line into multiple lines for improved clarity. Other minor formatting adjustments were made to enhance code maintainability.
Refactor stop conditions by moving the stop checking logic into the 'nextJob' function. This ensures that the worker gracefully stops picking up new jobs when the stop time is reached, addressing potential race conditions and improving readability.
@inlife
Copy link
Owner

inlife commented Aug 1, 2024

Everything looks good. However, I just wonder, what is the motivation behind this? What would be the use case where this would be useful?

@schubc
Copy link
Contributor Author

schubc commented Aug 1, 2024

We create several hundred automated videos a day.

We'd like to use our nomal office workstations for rendering during off-hours, this option is used to gracefully stop rendering before office hours.

@inlife
Copy link
Owner

inlife commented Aug 1, 2024

Ah, I see. Makes total sense!

@inlife inlife merged commit 0aeed1e into inlife:master Aug 1, 2024
1 check passed
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