$self->start_worker($function_name)
Start a worker.
Should call $function_name->run_locally( $args, $job )
to do the actual work. $job
is job handle or identifier used by helpers (e.g. set_job_progress()
).
Parameters:
Function name (e.g. "NinetyNineBottlesOfBeer")
$self->run_job_sync($function_name, $args, $priority)
Run a job synchronously (wait for the job to complete and return the result).
Parameters:
Function name (e.g. "NinetyNineBottlesOfBeer")
Hashref with arguments or undef
Returns job result (whatever the job subroutine returned).
$self->run_job_async($function_name, $args, $priority)
Run a job asynchronously (add job to the job queue and return instantly).
Parameters:
Function name (e.g. "NinetyNineBottlesOfBeer")
Hashref with arguments or undef
Returns string job ID that can be used to track the job.
$self->job_id_from_handle($job)
Return string job identifier for handle.
Parameters:
Job handle or identifier
$self->set_job_progress($job, $numerator, $denominator)
Provide progress report while running the task (from run()
).
Examples:
$self->set_progress(3, 10)
3 out of 10 subtasks are complete.
$self->set_progress(45, 100)
45 out of 100 subtasks are complete (or 45% complete).
Parameters:
Job handle or identifier
Numerator
Denominator
$self->job_status($function_name, $job_id)
Get job status.
Parameters:
Class instance ("self")
Function name (e.g. "NinetyNineBottlesOfBeer")
Job ID (e.g. "H:localhost.localdomain:8")
Returns array with job status:
Returns undef if the job ID was not found; dies on error.
$self->show_jobs()
Show all jobs on all the configured servers.
Returns a hashref of servers and their jobs, e.g.:
Returns undef
on error.
$self->cancel_job($job_id)
Remove a given job from all the configured servers' queues.
Parameters:
job ID (e.g. "H:localhost.localdomain:8")
Returns true (1) if the job has been cancelled, false (undef
) on error.
$self->server_status()
Get status from all the configured servers.
Returns a hashref of servers and their statuses, e.g.:
Returns undef
on error.
$self->workers()
Get a list of workers from all the configured servers.
Returns a hashref of servers and their workers, e.g.:
Returns undef
on error.