drmr package

Submodules

drmr.config module

drmr.config.get_available_resource_managers()[source]
drmr.config.get_resource_manager(name)[source]

Given the name of a resource manager, return an instance of it.

drmr.config.guess_resource_manager()[source]

Try to determine the resource manager in use.

drmr.config.load_configuration(config=None, file=None)[source]

Loads a drmr config in JSON format.

If a configuration dictionary is supplied, only the parameters for which it lacks values will be updated. So you can for example parse command line arguments, put them in a dictionary, and backfill it from the user config file.

If file is not specified, it defaults to ~/.drmrc.

drmr.exceptions module

exception drmr.exceptions.ConfigurationError[source]

Bases: exceptions.EnvironmentError

exception drmr.exceptions.ControlError(returncode, cmd, output=None, job_ids=None)[source]

Bases: subprocess.CalledProcessError

Base exception for job control commands: submit, delete, alter.

action = ''
exception drmr.exceptions.DeletionError(returncode, cmd, output=None, job_ids=None)[source]

Bases: drmr.exceptions.ControlError

action = 'delete'
exception drmr.exceptions.SubmissionError(returncode, cmd, output=None, job_ids=None)[source]

Bases: drmr.exceptions.ControlError

action = 'submit'

drmr.script module

drmr.script.is_boring(line)[source]

Return True if the line is empty or a comment that does not contain a directive.

drmr.script.is_comment(line)[source]

Return True if the line starts with a shell comment marker (#).

drmr.script.is_continued(line)[source]

Return true if the line ends with a backslash (and possibly whitespace).

drmr.script.is_directive(line)[source]
drmr.script.is_empty(line)[source]

Return True if the line contains nothing more than whitespace.

drmr.script.parse_directive(line)[source]

Parse a drmr directive from the line, returning a tuple of the directive and its arguments.

drmr.script.parse_script(script)[source]

Parse a POSIX script for submission.

drmr.util module

drmr.util.absjoin(*paths)[source]

Simple combination of os.path.abspath and os.path.join.

drmr.util.make_time_string(days=0, hours=0, minutes=0, seconds=0)[source]
drmr.util.makedirs(*paths)[source]

Creates each path given.

An exception will be raised if any path exists and is not a directory.

drmr.util.merge_mappings(*mappings)[source]
drmr.util.normalize_memory(memory)[source]

Normalizes a string describing an amount of memory.

Returns the equivalent in megabytes, or the original value if it can’t be parsed.

drmr.util.normalize_time(time)[source]

Normalizes a string describing a duration.

Accepts seconds up through days, e.g.:

“18d 1.99h 2min 3.5seconds”

If the input can be parsed, returns a string containing whole integers in the format hours:minutes:seconds.

Raises SyntaxError if the input cannot be parsed.

drmr.util.parse_time(time_string)[source]
drmr.util.tally_time_units(regex, time_string)[source]

Module contents