toil.options.common

Module Contents

Functions

parse_set_env(l)

Parse a list of strings of the form "NAME=VALUE" or just "NAME" into a dictionary.

parse_str_list(s)

parse_int_list(s)

iC(min_value[, max_value])

Returns a function that checks if a given int is in the given half-open interval.

fC(minValue[, maxValue])

Returns a function that checks if a given float is in the given half-open interval.

parse_accelerator_list(specs)

Parse a string description of one or more accelerator requirements.

parseBool(val)

make_open_interval_action(min[, max])

Returns an argparse action class to check if the input is within the given half-open interval.

parse_jobstore(jobstore_uri)

Turn the jobstore string into it's corresponding URI

add_base_toil_options(parser[, jobstore_as_flag, cwl])

Add base Toil command line options to the parser.

Attributes

logger

defaultTargetTime

SYS_MAX_SIZE

JOBSTORE_HELP

toil.options.common.logger
toil.options.common.defaultTargetTime = 1800
toil.options.common.SYS_MAX_SIZE = 9223372036854775807
toil.options.common.parse_set_env(l)[source]

Parse a list of strings of the form “NAME=VALUE” or just “NAME” into a dictionary.

Strings of the latter from will result in dictionary entries whose value is None.

>>> parse_set_env([])
{}
>>> parse_set_env(['a'])
{'a': None}
>>> parse_set_env(['a='])
{'a': ''}
>>> parse_set_env(['a=b'])
{'a': 'b'}
>>> parse_set_env(['a=a', 'a=b'])
{'a': 'b'}
>>> parse_set_env(['a=b', 'c=d'])
{'a': 'b', 'c': 'd'}
>>> parse_set_env(['a=b=c'])
{'a': 'b=c'}
>>> parse_set_env([''])
Traceback (most recent call last):
...
ValueError: Empty name
>>> parse_set_env(['=1'])
Traceback (most recent call last):
...
ValueError: Empty name
Parameters:

l (List[str])

Return type:

Dict[str, Optional[str]]

toil.options.common.parse_str_list(s)[source]
Parameters:

s (str)

Return type:

List[str]

toil.options.common.parse_int_list(s)[source]
Parameters:

s (str)

Return type:

List[int]

toil.options.common.iC(min_value, max_value=None)[source]

Returns a function that checks if a given int is in the given half-open interval.

Parameters:
  • min_value (int)

  • max_value (Optional[int])

Return type:

Callable[[int], bool]

toil.options.common.fC(minValue, maxValue=None)[source]

Returns a function that checks if a given float is in the given half-open interval.

Parameters:
Return type:

Callable[[float], bool]

toil.options.common.parse_accelerator_list(specs)[source]

Parse a string description of one or more accelerator requirements.

Parameters:

specs (Optional[str])

Return type:

List[toil.job.AcceleratorRequirement]

toil.options.common.parseBool(val)[source]
Parameters:

val (str)

Return type:

bool

toil.options.common.make_open_interval_action(min, max=None)[source]

Returns an argparse action class to check if the input is within the given half-open interval. ex: Provided value to argparse must be within the interval [min, max) Types of min and max must be the same (max may be None)

Parameters:
  • min (Union[int, float]) – float/int

  • max (Optional[Union[int, float]]) – optional float/int

Returns:

argparse action class

Return type:

Type[argparse.Action]

toil.options.common.parse_jobstore(jobstore_uri)[source]

Turn the jobstore string into it’s corresponding URI ex: /path/to/jobstore -> file:/path/to/jobstore

If the jobstore string already is a URI, return the jobstore: aws:/path/to/jobstore -> aws:/path/to/jobstore :param jobstore_uri: string of the jobstore :return: URI of the jobstore

Parameters:

jobstore_uri (str)

Return type:

str

toil.options.common.JOBSTORE_HELP = Multiline-String
Show Value
"""The location of the job store for the workflow.  A job store holds persistent information about the jobs, stats, and files in a workflow. If the workflow is run with a distributed batch system, the job store must be accessible by all worker nodes. Depending on the desired job store implementation, the location should be formatted according to one of the following schemes:

file:<path> where <path> points to a directory on the file systen

aws:<region>:<prefix> where <region> is the name of an AWS region like us-west-2 and <prefix> will be prepended to the names of any top-level AWS resources in use by job store, e.g. S3 buckets.

 google:<project_id>:<prefix> TODO: explain

For backwards compatibility, you may also specify ./foo (equivalent to file:./foo or just file:foo) or /bar (equivalent to file:/bar)."""
toil.options.common.add_base_toil_options(parser, jobstore_as_flag=False, cwl=False)[source]

Add base Toil command line options to the parser. :param parser: Argument parser to add options to :param jobstore_as_flag: make the job store option a –jobStore flag instead of a required jobStore positional argument. :param cwl: whether CWL should be included or not

Parameters:
Return type:

None