gc3libs.backends.arc0

Job control on ARC0 resources.

class gc3libs.backends.arc0.ArcLrms(name, architecture, max_cores, max_cores_per_job, max_memory_per_core, max_walltime, auth, arc_ldap=None, frontend=None, lost_job_timeout=120, **extra_args)

Manage jobs through the ARC middleware.

In addition to attributes

Attribute name Type Required?
arc_ldap string  
frontend string yes
cancel_job(*args, **kwargs)

Cancel a running job. If app is associated to a queued or running remote job, tell the execution middleware to cancel it.

close()

Return True if the list of files is expressed in one of the file transfer protocols the LRMS supports.

Return False otherwise.

free(*args, **kwargs)

Free up any remote resources used for the execution of app. In particular, this should delete any remote directories and files.

Call this method when app.execution.state is anything other than TERMINATED results in undefined behavior and will likely be the cause of errors later on. Be cautious.

get_resource_status(obj, *args)

Get dynamic information from the ARC infosystem and set attributes on the current object accordingly.

The following attributes are set:

  • total_queued
  • free_slots
  • user_running
  • user_queued
get_results(*args, **kwargs)

Retrieve job output files into local directory download_dir.

Directory download_dir must already exists.

If optional 3rd argument overwrite is False (default), then existing files within download_dir (or subdirectories thereof) will not be altered in any way.

If overwrite is instead True, then the (optional) 4th argument changed_only determines what files are overwritten:

  • if changed_only is True (default), then only files for which the source has a different size or has been modified more recently than the destination are copied;
  • if changed_only is False, then all files in source will be copied into destination, unconditionally.

Output files that do not exist in download_dir will be copied, independently of the overwrite and changed_only settings.

Parameters:
  • job (Task) – the Task instance whose output should be retrieved
  • download_dir (str) – path to download files into
  • overwrite (bool) – if False, do not download files that already exist
  • changed_only (bool) – if both this and overwrite are True, only overwrite those files such that the source is newer or different in size than the destination.
peek(*args, **kwargs)

Download size bytes (at offset offset from the start) from remote file remote_filename and write them into local_file. If size is None (default), then snarf contents of remote file from offset unto the end.

First argument remote_filename is the path to a file relative to the remote job “sandbox”.

Argument local_file is either a local path name (string), or a file-like object supporting a .write() method. If local_file is a path name, it is created if not existent, otherwise overwritten. In any case, upon exit from this procedure, the stream will be positioned just after the written bytes.

Fourth optional argument offset is the offset from the start of the file. If offset is negative, it is interpreted as an offset from the end of the remote file.

Any exception raised by operations will be re-raised to the caller.

submit_job(*args, **kwargs)

Submit an Application instance to the configured computational resource; return a gc3libs.Job instance for controlling the submitted job.

This method only returns if the job is successfully submitted; upon any failure, an exception is raised.

Note:

  1. job.state is not altered; it is the caller’s responsibility to update it.
  2. the job object may be updated with any information that is necessary for this LRMS to perform further operations on it.
update_job_state(obj, *args)

Query the state of the ARC0 job associated with app and update app.execution.state accordingly. Return the corresponding Run.State; see Run.State for more details.

The mapping of ARC0 job statuses to Run.State is as follows:

ARC job status Run.State
ACCEPTED SUBMITTED
ACCEPTING SUBMITTED
SUBMITTING SUBMITTED
PREPARING SUBMITTED
PREPARED SUBMITTED
INLRMS:Q SUBMITTED
INLRMS:R RUNNING
INLRMS:O STOPPED
INLRMS:E STOPPED
INLRMS:S STOPPED
INLRMS:H STOPPED
FINISHING RUNNING
EXECUTED RUNNING
FINISHED TERMINATING
CANCELING TERMINATING
FINISHED TERMINATING
FAILED TERMINATING
KILLED TERMINATED
DELETED TERMINATED

Any other ARC job status is mapped to Run.State.UNKNOWN. In particular, querying a job ID that is not found in the ARC information system will result in UNKNOWN state, as will querying a job that has just been submitted and has not yet found its way to the infosys.

validate_data(data_file_list)

Return True if the list of files is expressed in one of the file transfer protocols the LRMS supports.

Return False otherwise.