[Backgroundrb-devel] Fwd: best approach to managing workers and getting status

hemant gethemant at gmail.com
Thu Jul 17 05:06:37 EDT 2008


---------- Forwarded message ----------
From: hemant <gethemant at gmail.com>
Date: Thu, Jul 17, 2008 at 2:36 PM
Subject: Re: [Backgroundrb-devel] best approach to managing workers
and getting status
To: Frank Schwach <f.schwach at uea.ac.uk>


On Thu, Jul 17, 2008 at 1:46 PM, Frank Schwach <f.schwach at uea.ac.uk> wrote:
> Thanks Hemant,
>
> Yes, I saw the part about the persistent job queue but I have a couple
> of questions about this:
>
> What does the table for the job queue look like?
>

You can open mysql or whatever db you are using and run:

desc bdrb_job_queues;

to see, whats the schema of the table.

> How do I set other states of the job like "error"? Is the job status
> changed from "pending" to "running" automatically in the table so that I
> can query this table for pending/running/completed jobs?

When a task is pulled out of queue, its flagged as taken and you can
specify a timeout period while creating a task. When you invoke
"#finish!" task is marked finished. There is no, "error", because, if
you a task is "taken" and not "finished!" within specified period, its
automatically considered in error state.


>
> Can I get the jobs ID from within the worker so that I can update the
> job queue table "manually" too? If I want to record a "percentage
> completion" I guess I would need that.

Sure, from anywhere in your worker code, you can use, 'persistent_job'
attribute to get task thats dequed from job queue and is currently
running.


> Can I specify the (remote) host with enq_some_job like I can with the
> async_enque_job method?

You can't, because for persistent tasks, it doesn't matter, the worker
which fetches the task first, gets to execute it anyway.



-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org


More information about the Backgroundrb-devel mailing list