Script Reference

The scripts Module

Console scripts.

class chrysalio.scripts.ScriptRegistry(settings)[source]

Class to simulate Application Registry.

class chrysalio.scripts.Script(args, create_all, includes=None, dbsession_factory=None)[source]

Base class for a script which reads the INI file and interacts with the database.

Parameters:
  • args (argparse.Namespace) – Command line arguments.

  • create_all (bool) – If True, it creates all the tables, otherwise, it checks if the table users exists with at least one user.

  • includes (list) – (optional) List of hard coding includes.

  • dbsession_factory (sqlalchemy.orm.session.sessionmaker) – (optional) Function to create session.

classmethod argument_parser(description)[source]

Create an argument parser object to parse command line arguments.

Parameters:

description (str) – Description of the script.

Return type:

argparse.ArgumentParser

classmethod arguments(parser, args=None, filemode='w')[source]

Retrieve arguments from parser, check them and setup logging.

Parameters:
  • parser (argparse.ArgumentParser) – Configuration parser object.

  • args (list) – (optional) Command line arguments (for testing).

  • filemode (str) – File mode for logging ('w' or 'a').

Return type:

argparse.Namespace

The scripts.cioexecute Script

Console script to execute jobs.

cioservice.scripts.cioexecute.main(args=None)[source]

Main function.

class cioservice.scripts.cioexecute.Execute(args, includes=None, dbsession_factory=None)[source]

Class to execute jobs.

Parameters:
classmethod argument_parser(description='Execute jobs.')[source]

Create an argument parser object to parse command line arguments.

Parameters:

description (str) – (optional) Description of the script populating the database.

Return type:

argparse.ArgumentParser

run()[source]

Execute jobs.

Return type:

int

Returns:

Exit code.