vivarium_cluster_tools Utilities

Making directories is hard.

vivarium_cluster_tools.utilities.get_cluster_name()[source]

Returns the hostname

Return type:

str

vivarium_cluster_tools.utilities.get_drmaa()[source]
Return type:

Any

vivarium_cluster_tools.utilities.mkdir(path, umask=2, exists_ok=False, parents=False)[source]

Utility method to create a directory with specified permissions.

Parameters:
  • path (str | Path) – Path of the directory to create.

  • umask (int) – Umask specifying the desired permissions - defaults to 0o002.

  • exists_ok (bool) – If False, raises FileExistsError if the directory already exists.

  • parents (bool) – If False, raises FileNotFoundError if the directory’s parent doesn’t exist.

Return type:

None

vivarium_cluster_tools.utilities.backoff_and_retry(backoff_seconds=30, num_retries=3, log_function=<built-in function warn>)[source]

Adds a retry handler to the decorated function.

Parameters:
  • backoff_seconds (int | float) – Number of seconds to wait until retrying the operation.

  • num_retries (int) – Number of times to retry before failing.

  • log_function (Callable[[str], None]) – A callable used to emit retry messages. Defaults to emitting a standard library warning.