MEga COnstellation emulator
Meco is a gRPC-based application that simulates and manages a Low Earth Orbit (LEO) Mega Constellation. It provides a command-line interface (CLI) to:
- Start a background gRPC server (
on) - Stop the server (
off) - Send a resource descriptor file to the server (
start)
- Manage a gRPC server via CLI
- Supports daemonized execution
- Implements structured logging using Python's logging module
- Supports auto-completion with argcomplete
- Uses gRPC for communication
pip install argcomplete grpcio grpcio-toolsFor Bash users:
eval "$(register-python-argcomplete meco)"For global auto-completion (one-time setup):
activate-global-python-argcompleteEnsure you have the meco.proto file and run:
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. meco.protopython meco.py onRuns the server in the background and stores its PID in /tmp/meco_server.pid.
python meco.py offStops the server by terminating the background process.
python meco.py start config.jsonSends config.json to the gRPC server for processing.
python meco.py --helppython meco.py onOutput:
2025-02-07 12:00:00 [INFO] Meco server turned ON in background (PID: 12345).
python meco.py offOutput:
2025-02-07 12:05:00 [INFO] Turning OFF Meco server (PID: 12345)...
2025-02-07 12:05:01 [INFO] Meco server turned OFF.
python meco.py start my_config.jsonIf the file exists:
2025-02-07 12:10:00 [INFO] Successfully started with resource file: my_config.json
If the file is missing:
2025-02-07 12:10:05 [ERROR] Error: File 'my_config.json' does not exist.
python meco.py --helpOutput:
usage: meco [-h] {on,off,start} ...
Emulates a LEO Mega Constellation
positional arguments:
{on,off,start} Available commands
on Turn the Meco gRPC server ON (daemon mode)
off Turn the Meco gRPC server OFF
start Send a resource descriptor file to the Meco server
optional arguments:
-h, --help show this help message and exit
Meco uses Python's logging module for structured logs.
Log levels used:
- INFO → General information (
logger.info()) - WARNING → Server status (
logger.warning()) - ERROR → Issues (
logger.error())
2025-02-07 12:00:00 [INFO] Meco server started on port 50051.
2025-02-07 12:05:30 [INFO] Start() called with resource descriptor file: config.json
2025-02-07 12:06:10 [ERROR] Error: File 'config.json' does not exist.
git clone https://github.com/your-repo/meco.git
cd mecoIt is recommended to use a virtual environment to isolate dependencies.
For Linux/macOS:
python3 -m venv venv
source venv/bin/activateFor Windows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtpython -m grpc_tools.protoc --versionpython -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. meco.protopython meco.py onpython meco.py start test.jsondeactivateCheck if the PID file exists:
cat /tmp/meco_server.pidManually stop the process:
kill -9 $(cat /tmp/meco_server.pid)
rm /tmp/meco_server.pidEnsure the file exists:
ls -lh file.jsonRe-enable argcomplete:
eval "$(register-python-argcomplete meco)"This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- Add Docker support for containerized deployment
- Add unit tests for CLI and gRPC services
- Stefano Salsano - Maintainer