|
@@ -162,6 +162,12 @@ class Task:
|
|
|
TaskManager.notify.error("deprecated task.setPriority() called; use setSort() instead")
|
|
TaskManager.notify.error("deprecated task.setPriority() called; use setSort() instead")
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
|
|
+ def getName(self):
|
|
|
|
|
+ return self.name
|
|
|
|
|
+
|
|
|
|
|
+ def setName(self, name):
|
|
|
|
|
+ self.name = name
|
|
|
|
|
+
|
|
|
def getDelay(self):
|
|
def getDelay(self):
|
|
|
return self.delayTime
|
|
return self.delayTime
|
|
|
|
|
|
|
@@ -202,13 +208,12 @@ class Task:
|
|
|
self.pstatCollector = PStatCollector("Tasks:" + name)
|
|
self.pstatCollector = PStatCollector("Tasks:" + name)
|
|
|
self.pstatCollector.addLevelNow(1)
|
|
self.pstatCollector.addLevelNow(1)
|
|
|
|
|
|
|
|
- def finishTask(self, verbose):
|
|
|
|
|
|
|
+ def finishTask(self):
|
|
|
if hasattr(self, "uponDeath"):
|
|
if hasattr(self, "uponDeath"):
|
|
|
self.uponDeath(self)
|
|
self.uponDeath(self)
|
|
|
- if verbose:
|
|
|
|
|
- # We regret to announce...
|
|
|
|
|
- messenger.send('TaskManager-removeTask', sentArgs = [self, self.name])
|
|
|
|
|
del self.uponDeath
|
|
del self.uponDeath
|
|
|
|
|
+ # We regret to announce...
|
|
|
|
|
+ messenger.send('TaskManager-removeTask', sentArgs = [self])
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
|
if hasattr(self, 'name'):
|
|
if hasattr(self, 'name'):
|
|
@@ -429,7 +434,6 @@ class TaskManager:
|
|
|
self.fKeyboardInterrupt = 0
|
|
self.fKeyboardInterrupt = 0
|
|
|
self.interruptCount = 0
|
|
self.interruptCount = 0
|
|
|
self.resumeFunc = None
|
|
self.resumeFunc = None
|
|
|
- self.fVerbose = 0
|
|
|
|
|
# Dictionary of task name to list of tasks with that name
|
|
# Dictionary of task name to list of tasks with that name
|
|
|
self.nameDict = {}
|
|
self.nameDict = {}
|
|
|
|
|
|
|
@@ -451,10 +455,6 @@ class TaskManager:
|
|
|
def setStepping(self, value):
|
|
def setStepping(self, value):
|
|
|
self.stepping = value
|
|
self.stepping = value
|
|
|
|
|
|
|
|
- def setVerbose(self, value):
|
|
|
|
|
- self.fVerbose = value
|
|
|
|
|
- messenger.send('TaskManager-setVerbose', sentArgs = [value])
|
|
|
|
|
-
|
|
|
|
|
def getTaskDurationWarningThreshold(self):
|
|
def getTaskDurationWarningThreshold(self):
|
|
|
return self.taskDurationWarningThreshold
|
|
return self.taskDurationWarningThreshold
|
|
|
|
|
|
|
@@ -605,10 +605,9 @@ class TaskManager:
|
|
|
task.wakeTime = currentTime + delayTime
|
|
task.wakeTime = currentTime + delayTime
|
|
|
# Push this onto the doLaterList. The heap maintains the sorting.
|
|
# Push this onto the doLaterList. The heap maintains the sorting.
|
|
|
heappush(self.__doLaterList, task)
|
|
heappush(self.__doLaterList, task)
|
|
|
- if self.fVerbose:
|
|
|
|
|
- # Alert the world, a new task is born!
|
|
|
|
|
- messenger.send('TaskManager-spawnDoLater',
|
|
|
|
|
- sentArgs = [task, task.name, task.id])
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Alert the world, a new task is born!
|
|
|
|
|
+ #messenger.send('TaskManager-spawnDoLater', sentArgs = [task])
|
|
|
|
|
|
|
|
if task.owner:
|
|
if task.owner:
|
|
|
task.owner._addTask(task)
|
|
task.owner._addTask(task)
|
|
@@ -709,10 +708,9 @@ class TaskManager:
|
|
|
if __debug__:
|
|
if __debug__:
|
|
|
if self.pStatsTasks and task.name != "igLoop":
|
|
if self.pStatsTasks and task.name != "igLoop":
|
|
|
task.setupPStats()
|
|
task.setupPStats()
|
|
|
- if self.fVerbose:
|
|
|
|
|
- # Alert the world, a new task is born!
|
|
|
|
|
- messenger.send(
|
|
|
|
|
- 'TaskManager-spawnTask', sentArgs = [task, task.name, index])
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Alert the world, a new task is born!
|
|
|
|
|
+ messenger.send('TaskManager-spawnTask', sentArgs = [task])
|
|
|
return task
|
|
return task
|
|
|
|
|
|
|
|
def remove(self, taskOrName):
|
|
def remove(self, taskOrName):
|
|
@@ -745,7 +743,7 @@ class TaskManager:
|
|
|
# '__removeTasksEqual: removing task: %s' % (task))
|
|
# '__removeTasksEqual: removing task: %s' % (task))
|
|
|
# Flag the task for removal from the real list
|
|
# Flag the task for removal from the real list
|
|
|
task.remove()
|
|
task.remove()
|
|
|
- task.finishTask(self.fVerbose)
|
|
|
|
|
|
|
+ task.finishTask()
|
|
|
return 1
|
|
return 1
|
|
|
else:
|
|
else:
|
|
|
return 0
|
|
return 0
|
|
@@ -759,7 +757,7 @@ class TaskManager:
|
|
|
for task in tasks:
|
|
for task in tasks:
|
|
|
# Flag for removal
|
|
# Flag for removal
|
|
|
task.remove()
|
|
task.remove()
|
|
|
- task.finishTask(self.fVerbose)
|
|
|
|
|
|
|
+ task.finishTask()
|
|
|
# Record the number of tasks removed
|
|
# Record the number of tasks removed
|
|
|
num = len(tasks)
|
|
num = len(tasks)
|
|
|
# Blow away the nameDict entry completely
|
|
# Blow away the nameDict entry completely
|
|
@@ -875,10 +873,9 @@ class TaskManager:
|
|
|
task.wakeTime = currentTime + task.delayTime
|
|
task.wakeTime = currentTime + task.delayTime
|
|
|
# Push this onto the doLaterList. The heap maintains the sorting.
|
|
# Push this onto the doLaterList. The heap maintains the sorting.
|
|
|
heappush(self.__doLaterList, task)
|
|
heappush(self.__doLaterList, task)
|
|
|
- if self.fVerbose:
|
|
|
|
|
- # Alert the world, a new task is born!
|
|
|
|
|
- messenger.send('TaskManager-againDoLater',
|
|
|
|
|
- sentArgs = [task, task.name, task.id])
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Alert the world, a new task is born!
|
|
|
|
|
+ #messenger.send('TaskManager-againDoLater', sentArgs = [task])
|
|
|
|
|
|
|
|
def __stepThroughList(self, taskPriList):
|
|
def __stepThroughList(self, taskPriList):
|
|
|
# Traverse the taskPriList with an iterator
|
|
# Traverse the taskPriList with an iterator
|
|
@@ -895,7 +892,7 @@ class TaskManager:
|
|
|
# If it was removed in show code, it will need finishTask run
|
|
# If it was removed in show code, it will need finishTask run
|
|
|
# If it was removed by the taskMgr, it will not, but that is ok
|
|
# If it was removed by the taskMgr, it will not, but that is ok
|
|
|
# because finishTask is safe to call twice
|
|
# because finishTask is safe to call twice
|
|
|
- task.finishTask(self.fVerbose)
|
|
|
|
|
|
|
+ task.finishTask()
|
|
|
taskPriList.remove(i)
|
|
taskPriList.remove(i)
|
|
|
self.__removeTaskFromNameDict(task)
|
|
self.__removeTaskFromNameDict(task)
|
|
|
# Do not increment the iterator
|
|
# Do not increment the iterator
|
|
@@ -921,7 +918,7 @@ class TaskManager:
|
|
|
task.remove()
|
|
task.remove()
|
|
|
# Note: Should not need to remove from doLaterList here
|
|
# Note: Should not need to remove from doLaterList here
|
|
|
# because this task is not in the doLaterList
|
|
# because this task is not in the doLaterList
|
|
|
- task.finishTask(self.fVerbose)
|
|
|
|
|
|
|
+ task.finishTask()
|
|
|
self.__removeTaskFromNameDict(task)
|
|
self.__removeTaskFromNameDict(task)
|
|
|
else:
|
|
else:
|
|
|
# assert TaskManager.notify.debug(
|
|
# assert TaskManager.notify.debug(
|