Il giorno venerdì 4 ottobre 2013 11:31:33 UTC+2, Marin Pranjić ha scritto:
>
>
>
>
> On Wed, Oct 2, 2013 at 4:13 PM, Niphlod <nip...@gmail.com <javascript:>>wrote:
>
>>
>>
>> Il giorno mercoledì 2 ottobre 2013 15:15:16 UTC+2, Marin Pranjić ha 
>> scritto:
>>
>>> Hi,
>>>
>>> I have a task queue that runs in the background. I want to switch to 
>>> scheduler because I need more workers.
>>> Queued tasks are long running (video transcoding, 10-20 minutes each).
>>>
>>> 1. If I terminate (Ctrl+C) scheduler process, scheduler_run record is 
>>> STOPPED and scheduler_task record is back to QUEUED status. That's cool.
>>> What happens if there is a system failure or power supply loss? Is the 
>>> record stuck at RUNNING or is there a mechanism that 'fixes' invalid state 
>>> once scheduler is up again?
>>> This is likely to happen multiple times.
>>>
>>
>> How do you handle it is up to you. schedule a task that inspects what has 
>> been done by your task, eventually prune temporary files, reschedule the 
>> task, do whatever you need. There's no limits in configuration because 
>> anyone needs different type of tasks ("retry blindly" vs "stop and warn me" 
>> approaches are very different and scheduler doesn't pose a limit on those). 
>> However in that particular case (assuming your using a TIMEOUT, which you 
>> definitely **should**) tasks in RUNNING will be marked as TIMEOUT.
>>  
>>
>
> What do you mean "using a TIMEOUT" ?
> I just tried: killall -s SIGKILL while my task was running. Once I started 
> scheduler again it was set to ASSIGNED. This is what I want, but I don't 
> understand timeout thing, can you please explain?
>

queue_task() uses the default timeout of 60 seconds. this means that a task 
can get at most 60 seconds to run. if you queue a task with a relly long 
timeout, than the scheduler won't potentially "return" from a runaway task 
and will most surely "hiccup" not processing any other task.

every once in while the schedulers watch over the schedulers that are not 
sending the heartbeat (most likely killed) and get every running task 
associated with those workers, updating those tasks to queued.
 

>  
>
>>
>>> 2. Is there a way of stopping a task without terminating a worker?
>>>
>>>
>> Nope, but it's not that hard to schedule the os to restart a worker if 
>> it's killed, and it's a task better handled separately (attached processes, 
>> zombie resources, etc). 
>> If you follow the deployment config with upstart as soon as it's killed 
>> it restarts automatically.
>>  
>>
>
> I'm not sure if I understand. I have 4 workers running, and I need to kill 
> only one of them and restart it. I don't want to restart other 3 workers. 
> How do I do that?
>  
>

set it as TERMINATE or KILL and then do web2py.py -K appname (or configure 
4 upstart services with web2py.py -K appname and let upstart restart them)

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to