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

Add a command to show info about a background job and force-execute it #27217

Merged
merged 5 commits into from
Oct 15, 2021

Conversation

nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented May 28, 2021

occ background:job 64 --force-execute 
Job class:            OCA\Files_Retention\BackgroundJob\RetentionJob
Arguments:            {"tag":2}
Type:                 timed

Last checked:         1970-01-01T00:00:00+00:00
Reserved at:          -
Last executed:        2021-05-28T12:57:12+00:00
Last duration:        0
Next execution:       2021-05-29T12:57:12+00:00

Forcing execution of the job
Job executed!

Job class:            OCA\Files_Retention\BackgroundJob\RetentionJob
Arguments:            {"tag":2}
Type:                 timed

Last checked:         1970-01-01T00:00:00+00:00
Reserved at:          -
Last executed:        2021-05-28T12:57:23+00:00
Last duration:        1
Next execution:       2021-05-29T12:57:23+00:00

The second job info is only printed for "timed" jobs that are not deleted while being executed.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the command, but the implementation feels a bit fragile 🙈

can we leave any job list related responsibility in the job list code and only fetch/invoke the job from the new command?

core/Command/Background/Job.php Outdated Show resolved Hide resolved
core/Command/Background/Job.php Outdated Show resolved Hide resolved
core/Command/Background/Job.php Outdated Show resolved Hide resolved
@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels May 28, 2021
@szaimen szaimen linked an issue May 31, 2021 that may be closed by this pull request
@nickvergessen nickvergessen force-pushed the techdebt/noid/make-debugging-a-cron-job-easier branch from 956d663 to 27ee8a7 Compare May 31, 2021 15:16
@nickvergessen nickvergessen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 31, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
@MichaIng
Copy link
Member

MichaIng commented Jun 6, 2021

This is great, I was always looking for such a feature. Would it be possible to add some kind of list command to list all registered background jobs, theirs IDs, schedule, last execution etc, e.g. in a table-ish print? But that's better an own PR.

@nickvergessen nickvergessen force-pushed the techdebt/noid/make-debugging-a-cron-job-easier branch from 2ee7531 to 340cfac Compare June 8, 2021 08:14
@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 13, 2021
@nickvergessen nickvergessen force-pushed the techdebt/noid/make-debugging-a-cron-job-easier branch from 340cfac to a68c891 Compare October 13, 2021 09:48
@nickvergessen
Copy link
Member Author

Rebased cleanly and adjusted since versions to 23

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the techdebt/noid/make-debugging-a-cron-job-easier branch from a68c891 to 3adc997 Compare October 14, 2021 07:59
@nickvergessen
Copy link
Member Author

Rebased and bumped autoloader

@skjnldsv skjnldsv merged commit f7a4ff4 into master Oct 15, 2021
@skjnldsv skjnldsv deleted the techdebt/noid/make-debugging-a-cron-job-easier branch October 15, 2021 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement occ system:cron like in owncloud
5 participants