Turn multiple computers into a compute cluster and execute code remotely inside isolated sandboxes.
- Python 3.12+
- pipx
- Deno
git clone https://github.com/blokkaDev/cluster.git
cd clusterpipx install .If pipx is not yet available in your PATH, run:
pipx ensurepathThen restart your terminal.
You should now be able to use acs from any directory:
acs --helpBefore starting ACS, you need to create the environment file:
data/secrets/.env
An example configuration is provided in:
data/secrets/.env.example
Copy the example file:
cp data/secrets/.env.example data/secrets/.envOn Windows PowerShell:
Copy-Item data/secrets/.env.example data/secrets/.envThen edit data/secrets/.env with your configuration.
# Worker
WORKER_ID=idd-2
WORKER_TOKEN=worker-secret-token
WORKER_HOST=0.0.0.0
WORKER_PORT=8001
WORKER_HOSTNAME=acs.worker-idd-2.local
# Manager
MANAGER_TOKEN=manager-secret-token
MANAGER_HOST=0.0.0.0
MANAGER_PORT=8000
MANAGER_HOSTNAME=acs.manager.local
MANAGER_REMEMBER=true
If you want to work on ACS without installing it globally, create a virtual environment.
Linux/macOS:
python3 -m venv .venvWindows:
python -m venv .venvLinux/macOS:
source .venv/bin/activateWindows PowerShell:
.venv\Scripts\Activate.ps1pip install -e .Deno is required to use the sandbox.
Linux/macOS:
curl -fsSL https://deno.land/install.sh | shWindows:
irm https://deno.land/install.ps1 | iexCheck the installation:
deno --versionIf the command is not available, restart your terminal.
ACS provides a CLI through the acs command.
Show the available commands:
acs --helpacs start --managerThe Manager uses the configuration defined by:
MANAGER_HOSTMANAGER_PORTMANAGER_TOKENMANAGER_HOSTNAME
acs start --workerThe Worker uses the configuration defined by:
WORKER_IDWORKER_HOSTWORKER_PORTWORKER_TOKENWORKER_HOSTNAME
The connect command requires the Manager address and authentication token:
acs connect <host> <port> <token> <worker_id>For example:
acs connect 127.0.0.1 8000 manager-secret-token idd-2The remember option can also be disabled:
acs connect 127.0.0.1 8000 manager-secret-token idd-2 --no-rememberLoad a worker by specifying its ID and the Manager token:
acs load <worker_id> <token>For example:
acs load idd-2 manager-secret-tokenTo execute a Python file on a Worker:
acs run <worker_id> file_name.py --pythonFor example:
acs run idd-2 example.py --pythonAt the moment, Python is the supported language for the run command.
A basic ACS workflow consists of starting the Manager, starting a Worker, connecting them, loading the Worker, and finally executing code.
acs start --manageracs start --workeracs connect <worker-host> <worker-port> <worker-token> <worker-id>For example:
acs connect 127.0.0.1 8000 worker-secret-token idd-2acs load idd-2 manager-secret-tokenacs run idd-2 example.py --pythonacs --help
acs connect <host> <port> <token> <worker_id>
acs load <worker_id> <token>
acs run <worker_id> <file> --python
acs start --manager
acs start --worker
acs listACS can also be run directly using Python.
This mode is mainly intended for development and debugging.
From the root of the project:
python main.pyNote: ACS is currently in its first CLI version. Some commands, options, and behaviours may change in future releases.