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-tools
For Bash users:
eval "$(register-python-argcomplete meco)"
For global auto-completion (one-time setup):
activate-global-python-argcomplete
Ensure you have the meco.proto
file and run:
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. meco.proto
python meco.py on
Runs the server in the background and stores its PID in /tmp/meco_server.pid
.
python meco.py off
Stops the server by terminating the background process.
python meco.py start config.json
Sends config.json
to the gRPC server for processing.
python meco.py --help
python meco.py on
Output:
2025-02-07 12:00:00 [INFO] Meco server turned ON in background (PID: 12345).
python meco.py off
Output:
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.json
If 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 --help
Output:
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 meco
It is recommended to use a virtual environment to isolate dependencies.
For Linux/macOS:
python3 -m venv venv
source venv/bin/activate
For Windows:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python -m grpc_tools.protoc --version
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. meco.proto
python meco.py on
python meco.py start test.json
deactivate
Check if the PID file exists:
cat /tmp/meco_server.pid
Manually stop the process:
kill -9 $(cat /tmp/meco_server.pid)
rm /tmp/meco_server.pid
Ensure the file exists:
ls -lh file.json
Re-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