Mixins

Clinner provides some useful mixins for main classes that adds different behaviors to these classes.

class HealthCheckMixin[source]

Adds health checking behavior to Main classes. To do that is necessary to define a health_check method responsible of return the current status of the application.

This mixin also adds a new parameter -r, --retry that defines the number of retries done after a failure. These retries uses an exponential backoff to calculate timing.

health_check()[source]

Does a health check.

Returns:True if health check was successful. False otherwise.
run(*args, **kwargs)[source]

Run specified command through system arguments.

Before running the command, a health check function will be called and if result is not successful, the command will be aborted.

Arguments that have been parsed properly will be passed through **kwargs. Unknown arguments will be passed as a list of strings through *args.

This method will print a header and the return code.