# gc3libs.backends.noop¶

Fake running applications, only useful for testing.

class gc3libs.backends.noop.NoOpLrms(name, architecture, max_cores, max_cores_per_job, max_memory_per_core, max_walltime, auth=None, **extra_args)

Simulate execution of an Application:class instance.

Upon every invocation of update_job_state() the application status is advanced to the next state (according to the normal progression SUBMITTED -> RUNNING -> TERMINATING).

This progression can be altered by assigning a different transition graph to attribute transition_graph on an instance. The transition graph has a two-level structure:

• keys are task execution states (e.g., Run.State.SUBMITTED)
• values are dictionaries, mapping a probability (i.e., a floating point number between 0.0 and 1.0) to a new state. All probabilities should sum to a number less then, or equal to, 1.0 – but this condition is not checked or enforced. Likewise, it is not checked nor enforced that the new state is a valid target state given the source.

Every invocation of update_job_state() results in the task execution state possibly changing to one of the target states, according to the given transition probabilities.

For example, the following transition graph specifies that a job in state SUBMITTED can change to RUNNING with 80% probability (and with 20% stay in SUBMITTED state); a job in state RUNNING has a 50% chance of transitioning to TERMINATING, 10% chance of being STOPPED and 40% chance of staying in state RUNNING; and a job in STOPPED state stays in STOPPED state forever:

| transition_graph = {
|   Run.State.SUBMITTED = {
|     0.80: Run.State.RUNNING,
|   },
|   Run.State.RUNNING = {
|     0.50: Run.State.TERMINATING,
|     0.10: Run.State.STOPPED,
|     0.40: Run.State.RUNNING, # implcit, could be omitted
|   },
|   Run.State.STOPPED = {
|     1.00: Run.State.STOPPED,
|   },
| }


All parameters taken by the base class LRMS are understood by this class constructor, but they are actually ignored.

cancel_job(app)

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

close()

This is a no-op for this backend.

free(app)

This is a no-op for this backend.

get_resource_status()

Update the status of the resource associated with this LRMS instance in-place. Return updated Resource object.

get_results(app, download_dir, overwrite=False, changed_only=True)

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(app, remote_filename, local_file, offset=0, size=None)

Not supported on this backend.

submit_job(app)

Transition app’s status to Run.State.SUBMITTED if possible.

Note that this method still checks that app’s requirements are compatible with what this resource was instanciated with, and that conversely the resource still has enough free cores/memory/etc to host a new application. So, submission to a No-Op resource may still fail!

update_job_state(app)

Advance app’s status to the next one in the normal execution graph.

validate_data(data_file_list=[])

Return False if any of the URLs in data_file_list cannot be handled by this backend.

The noop backend can not do any kind of I/O, so this method will only return True if the supplied list of files is empty.

gc3libs.backends.noop.random() → x in the interval [0, 1).