The Python scheduler for rich scheduling.
The Pure ZMQ scheduler does not allow routing schemes other than LRU, nor does it check msg_id DAG dependencies. For those, a slightly slower Python Scheduler exists.
Authors:
Bases: object
Simple container for a job
Bases: IPython.kernel.zmq.session.SessionFactory
Python TaskScheduler object.
This is the simplest object that supports msg_id based DAG dependencies. Only task msg_ids are checked, not msg_ids of jobs submitted via the MUX queue.
Called after self.targets[idx] just got the job with header. Override with subclasses. The default ordering is simple LRU. The default loads are the number of outstanding jobs.
return a list of available engine indices based on HWM
dispatch register/unregister events.
handle reply to our initial connection request
dispatch method for result replies
Dispatch job submission to appropriate handlers.
a task has become unreachable, send a reply with an ImpossibleDependency error.
Called after self.targets[idx] just finished a job. Override with subclasses.
handle a real task result, either success or failure
Deal with jobs resident in an engine that died.
handle an unmet dependency
callback for a job’s timeout.
The job may or may not have been run at this point.
check location dependencies, and run if they are met.
Resume accepting jobs.
Save a message for later submission when its dependencies are met.
Stop accepting jobs while there are no engines. Leave them in the ZMQ queue.
Submit a task to any of a subset of our targets.
dep_id just finished. Update our dependency graph and submit any jobs that just became runnable.
Called with dep_id=None to update entire graph for hwm, but without finishing a task.
Plain random pick.
Always pick the front of the line.
The content of loads is ignored.
Assumes LRU ordering of loads, with oldest first.
Pick two at random, use the LRU of the two.
The content of loads is ignored.
Assumes LRU ordering of loads, with oldest first.
Pick two at random using inverse load as weight.
Return the less loaded of the two.
Always choose the lowest load.
If the lowest load occurs more than once, the first occurance will be used. If loads has LRU ordering, this means the LRU of those with the lowest load is chosen.