Ruby‎ > ‎

Status

To get the status of a job, use the status method.

If you have access to the worker object, just call:

worker.status

If you only have the job ID, call:

SimpleWorker.service.status(job_id)

This will return a hash like:

{"task_id"=>"ece460ce-12d8-11e0-8e15-12313b0440c6",
 "status"=>"running",
 "msg"=>nil,
 "start_time"=>"2010-12-28T23:19:36+00:00",
 "end_time"=>nil,
 "duration"=>nil,
 "progress"=>{"percent"=>25}}

Note that job_id is the same as task_id. (Jobs were known as tasks at the onset.)

You can get the job id by calling the id method:

worker.task_id

Jobs vs Scheduled Jobs

Job ID/Task IDs are created for each specific job. Scheduled jobs have separate IDs called schedule_id.

worker.schedule_id

See the article on Get Schedules for more information.

Waiting Until Job Completes

There is also a convenience method worker.wait_until_complete that will wait until the status returned is completed or error.

NOTE: At present, wait_until_complete is for use with the queue method and not intended for run_local andschedule.

Comments