Marcin Zduniak
2008-Aug-14 14:25 UTC
[Backgroundrb-devel] best approach to managing workers and getting status
Hi Hemant, You are writing: "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." I am wondering what will happen with the task that was somehow shutdown after it was marked "taken" but before it was marked "finished". Will it be redone ? When ? Thank you and best regards, Marcin Zduniak Mobile Technology Lab, www.mobtechlab.com Private: www.zduniak.com ---------- Forwarded message ---------- From: hemant <[EMAIL PROTECTED]> Date: Thu, Jul 17, 2008 at 2:36 PM Subject: Re: [Backgroundrb-devel] best approach to managing workers and getting status To: Frank Schwach <[EMAIL PROTECTED]> On Thu, Jul 17, 2008 at 1:46 PM, Frank Schwach <[EMAIL PROTECTED]> 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
hemant
2008-Aug-14 14:36 UTC
[Backgroundrb-devel] best approach to managing workers and getting status
On 8/14/08, Marcin Zduniak <zduniak at gmail.com> wrote:> Hi Hemant, > > I am wondering what will happen with the task that was somehow > shutdown after it was marked "taken" but before it was marked > "finished". Will it be redone ? When ?Not automatically, I was hoping that, if tasks that are in such state, programmer will look for them in db and decide what todo with them (for example, why they didn''t finish, what went wrong, whether they are safe to be rerun again and stuff).