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

Could scheduler resume jobs execution after reload? #52

Open
Dkwcs opened this issue Sep 2, 2023 · 4 comments
Open

Could scheduler resume jobs execution after reload? #52

Dkwcs opened this issue Sep 2, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Dkwcs
Copy link

Dkwcs commented Sep 2, 2023

For now I see only one way to resume jobs execution after reloading service.
I have added custom wrapper over metadata_storage to get all jobs ids then data and use this jobs data to recreate jobs and run them again.
Maybe much more simple way exists?

@Dkwcs Dkwcs changed the title Could scheduler resume job execution after reload? Could scheduler resume jobs execution after reload? Sep 2, 2023
@azasypkin
Copy link
Contributor

Maybe much more simple way exists?

I would also be interested in a recommended approach for resuming jobs with tokio-cron-scheduler. Currently, I'm following a similar approach to what @Dkwcs is doing: fetching the job list and analyzing the extra to determine the specific job type: https://github.com/secutils-dev/secutils/blob/2f6c10bc5c47e0ef217fbd7874dd41ceda41ba8e/src/scheduler.rs#L79

@Dkwcs
Copy link
Author

Dkwcs commented Sep 2, 2023

Also metadata_storage trait doesn't have get_all method, only get_by_id(
It would be a lot easier to support jobs resume functionality if here no other ways exist.

@ilxqx
Copy link

ilxqx commented Nov 5, 2023

The key point here is actually how to correspond to JobCode. I took a brief look at the source code, and the crucial implementation is the implementation of this trait JobCode.

We need to customize our own implementation of JobCode, but there is a technical challenge here. The ID of this Job needs to be generated by ourselves so that we have a chance to match it after program restarts. However, its internal actual implementation is creating a new UUID every time: let job_id = Uuid::new_v4();.

Looking forward to the author providing a good solution directly.

@mvniekerk
Copy link
Owner

@Dkwcs - the get_all method will definitely help in this regard, also to specify the GUID in creating a Job.
Should be simple?

@mvniekerk mvniekerk added the enhancement New feature or request label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants