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.