autojob.cli package

Utilities, classes, and functions for CLI commands.

Submodules

autojob.cli.init module

Utilities for initializing autojob.

autojob.cli.main module

Define the CLI subcommands.

autojob.cli.main.add_subcommands() None[source]

Add CLI subcommands.

autojob.cli.run module

This module defines the autojob run CLI.

autojob.cli.run.run_script(script: Path, time_limit: float, frequency: float) NoReturn[source]

Run a script with a time limit.

Parameters:
  • script – The script to run.

  • time_limit – The time limit in seconds.

  • frequency – How frequently to check if the underlying function has completed.

autojob.cli.utils module

Utilities for CLI commands.

class autojob.cli.utils.FancyConsoleHandler(stream=None)[source]

Bases: StreamHandler

A handler that prints colourful output to stderr.

Initialize the handler.

If stream is not specified, sys.stderr is used.

emit(record: LogRecord)[source]

Emit a record using click.secho.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline in ANSI colours depending on the log level. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

autojob.cli.utils.configure_logging(console_log_level: int = 30) None[source]

Configure logging and printing for command-line functions.

The log file an dare read from the SETTINGS values. In particular,

Parameters:

console_log_level – The log level for messages printed to the console. Defaults to logging.WARNING.