April 2023
~744 words, 4 min read
The arb-trops-services
repository is a collection of Python packages developed by Acid3croco. It includes three main packages: arb_logger
, arb_watchdog
, and arb_launcher
. Each of these packages serves a unique purpose and is designed to work independently or in conjunction with the others.
arb_logger
is a Python package that provides advanced logging capabilities. It includes features such as file logging, console logging with colors, and Redis integration. The goal of this package is to simplify and standardize logging for Python applications by offering an easy-to-use interface and configurable options.
arb_alerts
program to listen to Redis streams and send alerts on MacOSTo install the arb_logger
package from PyPI, simply run the following command:
pip install arb_logger
To install the arb_logger
package from source, simply clone the repository and install it using pip:
git clone https://github.com/yourusername/arb_logger.git
cd arb_logger
pip install .
Here's an example of how to create a logger with default settings:
from arb_logger import get_logger
logger = get_logger('basic_logger')
logger.debug("Debug message")
logger.info("Info message")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical message")
In this example, we create a logger with custom settings:
from pathlib import Path
from arb_logger import get_logger
custom_path = Path("custom_logs")
logger = get_logger(name="my_logger", level=logging.DEBUG, path=custom_path,
log_in_file=True, short=False, redis_handler=True)
logger.debug("Debug message")
logger.info("Info message")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical message")
arb_watchdog
is a Python package designed to monitor and manage the status of specified processes. It uses Redis as a backend for storing process data and provides a simple API for interacting with this data. The package is highly configurable and can be used to monitor and manage a wide range of processes.
To install the arb_watchdog
package, you can use pip:
pip install arb_watchdog
To use arb_watchdog
, import the package and create a ProcessWatcher instance with the path to your configuration file:
from arb_watchdog.process_watcher import ProcessWatcher
config_file = "config.json"
process_watcher = ProcessWatcher(config_file=config_file)
You can then use the ProcessWatcher instance to perform various operations, such as getting the process list, updating process data, and getting process data for specified processes:
# Get the list of processes to monitor
process_list = process_watcher.get_process_list()
# Update process data
process_data = ProcessData(name="fake_process", pid=12345, status="UP")
process_watcher.update_process_data(process_data)
# Get process data for a specified process
process_data = process_watcher.get_process_data("fake_process")
arb_launcher
is a Python package that provides a simple yet powerful way to launch and manage detached programs and methods. It allows you to run external programs or Python methods in a completely detached process, making them independent of the parent process.
To install arb_launcher
, simply clone the repository and run the following command:
pip install arb_launcher
arb_launcher
provides a simple command-line interface for launching detached programs. You can also use it as a method or library in your Python projects.
Command-Line Interface:
arb_launcher <program> [args] [--stdout <stdout_file>] [--stderr <stderr_file>]
Simplified Launch Method:
from arb_launcher.launcher import launch_detached
launch_detached(target, args, stdout=None, stderr=None)
Python API:
from arb_launcher.program_handler import ProgramHandler
handler = ProgramHandler(target, args, stdout, stderr)
handler.launch()
Contributions to the arb-trops-services
repository are welcomed. Feel free to open issues, submit pull requests, or reach out to the maintainers if you have any questions or suggestions for improvements.
The arb-trops-services
packages are licensed under the MIT License.