saturnin._scripts.svcrun

Command-line script to run a single Saturnin service.

This script provides a convenient way to execute a Saturnin service either directly in the main thread or in a separate managed thread. It parses command-line arguments for configuration files, logging levels, and execution mode, then uses saturnin.component.single.SingleExecutor to manage the service lifecycle.

Functions

saturnin._scripts.svcrun.main(description: str | None = None, service_config: str | None = None)[source]

Saturnin script to run a single service, either directly in the main thread or in a separate, managed thread.

This function sets up command-line argument parsing, initializes logging and tracing, and then uses SingleExecutor to run the specified service based on the provided configuration.

Parameters:
  • description (str | None) – Custom description for the script, shown when --help is used. Defaults to a standard description.

  • service_config (str | None) – Default path for the SERVICE-CONFIG argument. If None, SERVICE-CONFIG becomes a required positional argument.

Command-line usage (auto-generated by argparse):

saturnin-service [-h] [-c CONFIG] [-s SECTION] [-q] [-o] [--main-thread]
                 [-l {critical,fatal,error,warn,warning,info,debug,notset}]
                 SERVICE-CONFIG

Positional arguments:
  SERVICE-CONFIG        Path to service configuration file

Optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Path to additional configuration file. Could be specified
                        multiple times. (default: None)
  -s SECTION, --section SECTION
                        Configuration section name (default: service)
  -q, --quiet           Suppress console output (default: False)
  -o, --outcome         Always print service execution outcome (default: False)
  --main-thread         Start the service in main thread (default: False)
  -l {critical,fatal,error,warn,warning,info,debug,notset},
  --log-level {critical,fatal,error,warn,warning,info,debug,notset}
                        Logging level (default: None)