Core

The otter.core module contains the main class for Otter, the Runner.

Runner is the class that is should be called in the root of the Otter application.

Note

Otter handles the logging by itself (to write the manifest), and uses the loguru library library for it. Ideally, Otter apps will stick to loguru. If the logging functionality is not enough, interfaces could be provided to extend the current setup.

core module

Main module.

class otter.core.Runner(name: str)[source]

Bases: object

Main class.

This class is the main entry point for Otter.

Upon instantiation, it will load the configuration, the scratchpad, and the specs. It will inialize the logger, create a task registry and register the built-in tasks.

Warning

The instantiation will raise SystemExit and end the program if any of the listed actions fail. Logging is done in a helpful way to aid in debugging.

name

The name of the runner.

This will identify the application using Otter. Usually an application will have a single runner.

The is used as the prefix in environment variables and will also be prepended to step names in the manifest. That way, multiple applications can report steps with the same name without colliding.

The name should beetween 2 and 32 characters and only contain lowercase letters, numbers and the underscore character.

start() None[source]

Start a run.

This method is used to start a run. It will check if the work path exists, and is writable, and create it if it doesn’t.

register_tasks(task_package: str) None[source]

Register tasks.

This method is used to register task classes. Otter implements a set of built-in tasks, but applications will likely want to define their own. This method allows users to register these by passing a package name. Usually, Otter applications will have a tasks package that contains the task classes in separate modules.

The package must be importable and the modules must contain a class with the same name as the module in camel case, which must subclass otter.task.model.Task.

Warning

This method will raise SystemExit and end the program if the package cannot be imported or the modules are missing required classes.

Parameters:

task_package (str) – The package containing the tasks.

run() None[source]

Run the step.