once the task is inserted you should not change it's values unless its in the QUEUED status (technically the ASSIGNED works too, but it's NOT recommended). there's no way for the scheduler to terminate a specific task once the task is started, unless you KILL the worker (setting the worker to TERMINATE will kill the worker as soon as the RUNNING task is finished). PS: if you need to execute a task n times, use the repeat argument. using time.sleep(something) in a task has the side-effect of NOT returning to the main loop to execute potentially new QUEUED tasks (every scheduler process is allowed to process a single task at a time). if you need to limit the time the task runs, use the timeout parameter.
If something is not clear please ask. On Monday, March 11, 2013 8:04:52 PM UTC+1, dlypka wrote: > > > I need a way to terminate a specific Scheduled Task while it is RUNNING. > I tried using Admin Database Admin to update the scheduler_task.stop_time > to a time close to now while it was running. > But the task continued for several more minutes and COMPLETED its normal 5 > minute run. > The task calls time.sleep(300) to make it run for 5 minutes. > > I guess the Scheduler is not looking at the db values every 3 seconds. > Is it just checking the in memory task object properties? > > Is there a way to update the in memory object properties of a task while > it is running? > > Thanks. > -- --- 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.