Bugs item #849732, was opened at 2003-11-26 16:54 Message generated for change (Comment added) made by cito You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104866&aid=849732&group_id=4866
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: TaskKit Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No 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) ---------------------------------------------------------------------- >Comment By: Christoph Zwerschke (cito) Date: 2008-11-08 00:05 Message: After 5 years I have now finally fixed this in r7612. The bug report and patch were very helpful. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-12-23 21:34 Message: Logged In: NO Ignore this patch. Two issues, I did discover side effects; and there is an extra colon (:) character in one line that breaks syntax correctness in python which causes the AppServer to not start. I will continue working on the problem. ---------------------------------------------------------------------- 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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Webware-devel mailing list Webware-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-devel