Skip to main content

Splight Runner

Project description

Splight Runner


The splight-runner package is a tool for running processes that may interact with the Splight Engine in order to report monitoring information of the process.

Description

The splight-runner main functionality is to run different kinds of Python processes related in some way to the Splight Engine, for example, components that were developed using the Splight Library.

For this reason, the different features in the runner are for reporting the status of the process and centralizing logs to be accessed through the Splight Engine. So the splight-runner is used when the process is launched from the Splight Engine, this means that it should not be used during the development of the component even though the process will be running under the splight-runner.

Usage

The package has different commands that can be used. Here you can find a list of all the commands with a short description and how to use them.

Running Components

The first command is used for running components that use the Splight Library. The command is

splight-runner run-component <path>/main.py --component-id=<component_id>

This command will execute the component whose main file is called main.py and will modify some default functioning in order to report the status of the component and send the logs of the component to the Splight Engine. In the next sections, you can find how these modifications are done by the splight-runner.

In order to this command work as expected some environment variables are needed. The following are the list of variables that should be configured before running the command:

SPLIGHT_ACCESS_ID=<access_id>
SPLIGHT_SECRET_KEY=<secret_key
SPLIGHT_PLATFORM_API_HOST=https://api.splight-ai.com
COMPONENT_ID=<component_id>

Some of the variables are pointing to the production environment, but if you are interested in using another environment like "integration" or maybe a local environment you need to modify the corresponding variable value.

It is important to mention that the splight-runner should be used for components that use the Splight Lib and Splight CLI grater than version 4.0.0. For components with older versions we can't ensure the proper functioning.

Structure

You may be asking what the splight-runner does in order to do whatever it does. Well, that's not an easy question to respond but let's try to explain a little bit.

So far, the package has two main functionalities, sending logs and reporting status. With the two features we already have a lot of magic is happening, but maybe in the future we will add some more.

splight-runner works as a wrapper around the process that will be executed, this means some configurations are done, so the process in question is executed.

For example, when the command run-component is used, the environment variable PYTHONPATH is modified in order to include the directory where the file sitecustomize.py of the splight-runner is located. That file is a Python configuration file that can be used to customize the behavior of Python's site module. The site module is responsible for setting up Python's runtime environment, including configuring paths, importing modules, and performing other site-specific tasks.

So, using this file we can modify the default behaviors of libraries, for example, we can modify the import process of modules or libraries in order to change or add a new behavior. This way we can modify the logging module and intercept the logging process to show the logs messages and also send the logs messages to the Splight Engine. Some similar implementation is used for reporting the component's status.

Development and Contributing

Since the main goal of the tool is to be used for running different kinds of Python processes, is mandatory not to interfere with the process's dependencies, this should be considered when adding new features for the splight-runner. This is the reason why some basic functionalities are implemented in the source code and not imported from a third-party library, for example, a command parser for the different commands was created in the code and no library was used like click or typer.

The package is fully dockerized, for testing new features you can use the docker image that can be build with the command

make build

For running the docker container the command is

make start

and to stop the container:

make stop

It is important to note that testing new features in the splight-runner is not an easy task, you may need to modify the docker-compose file in order to include new volumes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splight_runner-1.1.6.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splight_runner-1.1.6-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file splight_runner-1.1.6.tar.gz.

File metadata

  • Download URL: splight_runner-1.1.6.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for splight_runner-1.1.6.tar.gz
Algorithm Hash digest
SHA256 f6f6d1003ef440dc9527ff36ccf5b5b2b776526a5b894e075b97fdd1d8b86970
MD5 73afe0ca88705a68fc88af8a96093b6d
BLAKE2b-256 101c616f484acde4d38adf1fdad7d19ef10523bda33d078b8c869dd4114ed4ec

See more details on using hashes here.

File details

Details for the file splight_runner-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: splight_runner-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for splight_runner-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 779b0e50ae9f96ab74a55415e27b62d336b8e51a4857884e4664293084da3e37
MD5 3cd54d201f523bb7e06035c792cd05c6
BLAKE2b-256 9109a7536ab11ddb2c56aec470ff249d534e53bfb5510bb23db3b6d1804395be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page