Trees | Indices | Help |
|
---|
|
A class for running multiple concurrent jobs.
This module provides an extended version of the class
JobDJ
from the schrodinger.job.jobdj
module.
The name JobDJ
refers to an old implementation of
"Job-control for Distributed-Job drivers," and the module name
"queue" reflects the fact that added jobs are queued until
ready to run.
Like the original JobDJ
, its main purpose is to provide
for job distribution on multiple hosts. It will keep the number of active
jobs on each host at or under the number of processors specified. It can
also restart jobs (see documentation on max_retries in the JobDJ.__init__ method).
Additional functionality that is provided in this implementation includes the following:
Step by step instructions for basic use:
JobDJ
instance. You can optionally specify the
hosts to run the jobs on and the maximum number of jobs for each host
by passing a list (host, max_jobs) tuples. By default, the host list
is read from the SCHRODINGER_NODEFILE
, which is created
from the -HOST host list by jlaunch. For example:
job_dj = queue.JobDJ( [('localhost',1), ('cluster',20)] )
JobDJ
instance by calling the JobDJ.addJob method. Pass an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob) to the addJob
method.
For example:
job_dj.addJob(JobControlJob(["impact", "input1.inp"])) # Passing job control commands as a list of strings also works: job_dj.addJob(["impact", "input2.inp"])
job_dj.run()
Alternatively, you can use the updatedJobs generator:
for job in job_dj.updatedJobs(): job_dj.dump(filename)
This yields a job every time its status changes. One reason to do
things this way is to allow restarting from a pickle. (A
JobDJ
instance that is restored from a pickle can be
started with the run
method or updatedJobs
generator.)
Because an added job can be a BaseJob
instance,
additional functionality can be gained by subclassing. For example, the
JobDJ
instance that a job has been added to can be retrieved
with the getJobDJ
method and new jobs can be added
dynamically by a job at any point during its normal life cycle.
Copyright Schrodinger, LLC. All rights reserved.
|
|||
__metaclass__ type(object) -> the object's type type(name, bases, dict) -> a new type |
|||
BaseJob A base job class for jobs run under JobDJ .
|
|||
RequirementsJob This is a base class that indicates a job has special requirements (e.g. |
|||
LocalhostJob This class should be used as a mixin on a job type that requires jobs to be run on localhost. |
|||
SubprocessJob A job for running an external process. |
|||
JobControlJob This class defines a job control job to be run under JobDJ .
|
|||
LinkedListNode A node for the LinkedList class, holding a value, and a reference to the previous and next node in the list. |
|||
LinkedList A doubly linked list, providing constant time addition, size, and truth checks. |
|||
RunningJobs A LinkedList subclass that tracks running jobs and keeps a tally of jobs running on each machine. |
|||
_MultiJobFinalizer A class to allow specification of a function to be invoked when the final job of a group completes successfully. |
|||
PriorityQueue This is a general priority queue. |
|||
JobDJ Class for running commands/jobs in parallel under jobcontrol. |
|
|||
|
|||
|
|||
|
|||
|
|
Wrap a function that takes a single job as an argument so that it runs
in a separate directory. If |
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Aug 6 04:50:19 2015 | http://epydoc.sourceforge.net |