I thought eg.scheduler only starts a scheduled task, and then it will be released for another task.
But it is not. It is busy all the time, when the task is performed. Only when the job is completed, eg.scheduler can start another.
You can check this with a simple test:
Code: Select all
def fc(x, y = 'Y'):
import time
print "Long task start: ",time.ctime()
print "x, y =",x,y
time.sleep(10.0)
print "Long task stop: ",time.ctime()
def TEST():
eg.scheduler.AddTask(0.01, fc, "X", y="YY")
eg.scheduler.AddTask(5.0, fc, "XX", y="YYYY")
TEST()This can cause a delayed start another task (for example, from another plugin).
However, I tried to make some improvements.
I added methods AddLongTask and AddLongTaskAbsolute.
The syntax is exactly the same, only a task is run in a separate thread, so it does not matter how long it takes.
You can try the same test:
Code: Select all
def fc(x, y = 'Y'):
import time
print "Long task start: ",time.ctime()
print "x, y =",x,y
time.sleep(10.0)
print "Long task stop: ",time.ctime()
def TEST2():
eg.scheduler.AddLongTask(0.01, fc, "XXX", y="YYYYYY")
eg.scheduler.AddLongTask(5.0, fc, "XXXX", y="YYYYYYYY")
TEST2()Thanks, Pako
