Bugs item #849732, was opened at 2003-11-26 07:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=849732&group_id=4866

Category: TaskKit
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Can't unschedule a running task

Initial Comment:
If the TaskKit scheduler has a running task (i.e. a
task in the 'running' queue), there is no way to remove
that task from the Scheduler. There seem to be some
subtle reasons for this.
 
1) In TaskKit/Scheduler.py - unregisterTask(), the
method never checks if the task is in the running queue
so it can call unregister() on the task's handle
object. unregisterTask only checks the scheduled and
ondemand queues.
You'd think the following code:
 
 tm = app.taskManager()
 t = tm.running("mytask")
 if t:
    t.unregister()
 
 would work around this problem, but...
 
 2) when unregister() is called on a TaskHandler
object, it sets the
 value of _reregister and _rerun to 0 but, it doesn't
appear that the value of _reregister is ever checked
anywhere. It appears that the reschedule() method of
TaskHandler should check this value to determine an
appropriate return value.

3) When a running task that has been unregistered
completes and the Scheduler object's notifyCompletion()
method is called, it doesn't look like it is calling
handle.reschedule() in the correct place. What ends up
happening is a scheduled task is always returned back
to the scheduled queue with the original task
parameters even though it should be discarded after
completion - by virtue of the method call to unregister()

Here's a simple example of how these issues interact
with one another:
 - A user schedules a task that is subsequently
started; task object is in the running queue. While the
task is running, the user wants to modify the period of
the task. The following sequence of events occurs:
 - Scheduler.addPeriodicAction is called with a new set
of parameters but with the same task name as the
running task.
 - addPeriodicAction calls unregisterTask
 - unregisterTask checks the scheduled and ondemand
queues and finds nothing so it installs what it thinks
is a new task in the scheduled queue.
 - the original task finishes and is moved (with
original parameters) back to the scheduled queue,
overwriting the instance already in the scheduled queue.

This illustrates problem 1. Now assume the programmer
uses the technique described in 1 to unregister the
task in the running queue. You still encounter problem
2 and 3 and the end result is that the task in the
running queue still overwrites the task in the
scheduled queue.
 
Please review the attached patch which corrects issues
1, 2 & 3.

Brett Funderburg (brettf at deepfile dot com)



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=849732&group_id=4866


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to