I ran one test and it did indeed stop the task.
scheduler_run.status = 'STOPPED'
scheduler_task.status = 'QUEUED'
scheduler_worker.status = 'ACTIVE'
return value from stop_task() was 1

So I got 'QUEUED' rather than 'FAILED' but that seems logical to me.

My task function body was:

def task_fabrun(cmdstring):
    while True:
        time.sleep(.5) # time in seconds
    return cmdstring

Thanks.

On Mon, Mar 11, 2013 at 6:16 PM, Niphlod <niph...@gmail.com> wrote:

> ps: docs pretty self-explanatory, however ....
> setting STOP_TASK on the scheduler_worker row will terminate the currently
> RUNNING task (if any)
>
> given
> myscheduler = Scheduler(db, ....)
> in models,
> in your controller you can call
> actually_stopped = myscheduler.stop_task(15)
>
> that will terminate task with id 15, while with
>
> actually_stopped =
> myscheduler.stop_task('edeb8b54-dda8-4ff9-9585-2abb4a05c73a')
>
> will terminate task with uuid edeb8b54-dda8-4ff9-9585-2abb4a05c73a
>
> If the task is RUNNING it will be terminated --> execution will be set as
> FAILED by the worker as soon as the worker "reads" the STOP_TASK command
> (~3 secs), really_stopped will be 1
> If the task is QUEUED, its stop_time will be set as to "now", the enabled
> flag will be set to False, and the status will be set to STOPPED,
> really_stopped will be 1
> If the task is on any other task status, even if the reference passed to
> stop_task() is legit, nothing will be done, really_stopped will be None
>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/7-ZOS_In8IU/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
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