soprano.hpc.submitter.queues#
Definition of QueueInterface class.
Classes
|
QueueInterface object |
- class soprano.hpc.submitter.queues.QueueInterface(sub_cmd, list_cmd, kill_cmd, sub_outre, list_outre, list_user_opt=None)[source]#
Bases:
object
QueueInterface object
A class meant to simplify interfacing in a basic way with a Queue system. Contains commands to submit to the queue, list the job IDs, and kill them if necessary. Will contain Regexps to parse for IDs and additional information as returned upon submission and listing. It is important that the regular expressions used employ NAMED GROUPS to parse the various fields. In particular, a job_id group must ALWAYS be present. The class also provides some static variables implementing standard interfaces for common queueing systems. These can be retrieved by using QueueInterface.<NAME>. The currently implemented names are the following:
LSF (IBM’s managing system, using the command bsub)
- GridEngine (Sun’s managing system, also available in an open version,
using the command qsub)
PBS (another managing system using qsub)
Initialize the QueueInterface.
Args:sub_cmd (str): command used to submit a script to the queuelist_cmd (str): command used to list all queued jobs for the userkill_cmd (str): command used to kill a job given its idsub_outre (str): regular expression used to parse the output ofsub_cmd. Must contain at least a job_id namedgrouplist_outre (str): regular expression used to parse the output oflist_cmd. Must contain at least a job_id namedgrouplist_user_opt (Optional[str]): name of the option for passing aspecific user name when listingjobs. For example, on LSF this is-u. By default it’s None, and thedefault of the queueing system isused.- list(user='$USER')[source]#
List all jobs found in the queue
Returns:jobs (dict): a dict of jobs classified by ID containing all infothat can be matched through list_outreuser (Optional[str]): user for whom jobs should be listed. Willnot have any effect if list_user_opt has notbeen specified. Default is $USER.
- property remote_target#
RemoteTarget if a remote Host is set
- set_remote_host(host=None, timeout=1.0)[source]#
Set a remote host for use by this QueueInterface
If a remote host is set, this Interface will try using the Paramiko library to connect to it via SSH. Check the docstring of soprano.hpc.submitter.utils.RemoteTarget to see what the limitations are for this usage.
Args:host (Optional[str]): host name of the remote machine to connectto. Further information must be contained inthe user’s ~/.ssh/config file. If left emptythe remote host is UNSET and therefore theinterface goes back to local use.timeout (Optional[float]): connection timeout in seconds (defaultis 1 second)