Closed Bug 621256 Opened 14 years ago Closed 14 years ago

Allow jobqueue.pl to run once and then exit

Categories

(Bugzilla :: Administration, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: gerv, Assigned: gerv)

Details

Attachments

(1 file, 2 obsolete files)

Sometimes, for debugging or testing purposes, it's nice to run the jobqueue only once. TheSchwartz even has a method for this. So let's add a command-line parameter to jobqueue.pl which enables this behaviour. (I'm planning to use it in some tests for an extension, but I can see it being useful in general development and in core tests too.) Gerv
Attached patch Patch v.1 (obsolete) — Splinter Review
Assignee: administration → gerv
Status: NEW → ASSIGNED
Attachment #499619 - Flags: review?(mkanat)
Bit rot: [dkl@localhost trunk]$ patch -p0 < ~/Downloads/621256.diff patching file Bugzilla/JobQueue/Runner.pm Hunk #2 FAILED at 196. 1 out of 2 hunks FAILED -- saving rejects to file Bugzilla/JobQueue/Runner.pm.rej patching file jobqueue.pl
This patch was made against 3.6. But I just applied it to Bugzilla trunk as of now, and it worked fine (with a 5-line offset)... gerv@kitten:/usr/src/bugzilla$ pmp patch -p0 < /home/gerv/pm/621256.diff patching file Bugzilla/JobQueue/Runner.pm Hunk #2 succeeded at 201 (offset 5 lines). patching file jobqueue.pl gerv@kitten:/usr/src/bugzilla$ Gerv
Comment on attachment 499619 [details] [diff] [review] Patch v.1 Ah, I think this should be a new command instead of a switch. (Because it only applies to the "start" command.)
Attachment #499619 - Flags: review?(mkanat) → review-
Attached patch Patch v.2 (obsolete) — Splinter Review
OK, how about this :-) (This interacts with the other one to add a hook to the job queue, but it's fairly obvious how to fix one if the other is checked in first.) Gerv
Attachment #499619 - Attachment is obsolete: true
Attachment #500802 - Flags: review?(mkanat)
Comment on attachment 500802 [details] [diff] [review] Patch v.2 >=== modified file 'Bugzilla/JobQueue/Runner.pm' >+ my $jq = Bugzilla->job_queue(); >+ $jq->set_verbose($self->{debug}); >+ foreach my $module (values %{ Bugzilla::JobQueue::JOB_MAP() }) { >+ eval "use $module"; >+ $jq->can_do($module); >+ } >+ >+ $jq->work_once; Ah, this looks good, but could we abstract this out into an internal method, so that we don't have to have this code copied between gd_run and gd_other_cmd? It could just be a method that takes, as an argument, the method to call on $jq.
Attachment #500802 - Flags: review?(mkanat) → review-
Attached patch Patch v.3Splinter Review
Review comments addressed. Gerv
Attachment #500802 - Attachment is obsolete: true
Attachment #506359 - Flags: review?(mkanat)
Comment on attachment 506359 [details] [diff] [review] Patch v.3 Beautiful! Slight nit: The "else {" in gd_other_cmd() isn't needed, since the above block exits. You can just call $self->SUPER::gd_other_cmd() without a block.
Attachment #506359 - Flags: review?(mkanat) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 4.2
modified Bugzilla/JobQueue/Runner.pm modified jobqueue.pl Committed revision 7683. Gerv
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: