Service launch¶
Launch service using configuration file¶
The service is launched using the run.py script.
The virtual environment for the API service must be activated before the script launch.
The example of service launch from the service directory (“/var/lib/luna/current/luna-api/luna_api/”) is given below:
python run.py --port=5000 --config=./configs/myconfig.conf --log_suffix=test
In this example:
The service is launched using Python. Note, that Python version must be 3.10 or higher;
The service is launched on port 5000. It is the default port for the service;
Custom configuration file “myconfig.conf” is set using the relative path to the service directory. If there is no “–config” argument specified, the default configuration file “config.conf” is used. You can also use configs from the Configurator service (see Launch service using Configurator);
The output will be written to the log files with the “test” suffix.
Port, configuration file path and custom suffix for log files are set as command-line arguments. You can view help to find out more about command-line arguments using the following command:
python run.py --help
or
python run.py -h
Launch service using Configurator¶
It is possible to run service with the config received from the Configurator service.
To use the Configurator service for service launching, do not pass config param to run service, use “luna-config” instead of it.
To specify the Configurator service address and port, use the following command:
python run.py --port=5001 --luna-config http://127.0.0.1:5071/1 --log_suffix=test --use_detector=1
Where http://127.0.0.1:5071 is the available Configurator service address and 1 is the Configurator API version. By default the Configurator service is launched on the 5070 port.
It is possible to disable detector, extractor, estimator by using use_detector, use_extractor, use_estimator parameters (it needs 0 as parameter’s value to disable). For default, detector, extractor and estimator are enabled.
Running service on a port with configuration file and output to log files having suffix “test”. Port, path to configuration file and custom log files’ suffix are set as command line arguments.
If one does not pass –luna-config command-line argument, it can be specified in the [LUNA_CONFIGURATOR] section of a config file. While the value of USE_CONFIGURATOR is set to “0”, the settings from the configuration file are used. Otherwise, the settings from the Configurator service are used.
Set non-default setting in Configurator¶
It is possible to specify a tag for every setting to get the non-default setting. (see the LUNA Configurator documentation for more information). Example:
python run.py --INFLUX_MONITORING TAG_1
Where INFLUX_MONITORING is the setting name and TAG_1 is the desired tag for this setting.
See the full list of available tags using the following command:
python run.py --help