CLI that helps you quickly and easily run a long-running python program or any Docker container in a fargate task untill it completes.
- Active AWS credentials in your environment.
To install the CLI tool, navigate to the root of the project directory and run:
pip install .
Initialize the CLI tool by running:
oneoff init
This command will set up the necessary AWS infrastructure (which incurs no cost) to enable you to quickly run containers in ECS Fargate.
After initialization, you can view available commands by running:
oneoff --help
to see available commands.
The CLI helps you run any python script or Docker container in a task in ECS Fargate until the container or script completes and the task is terminated.
There are three types of invocations:
- Run a Python script without dependencies: Executes a Python script using a default container.
- Run a Python script with a custom
requirements.txt
file: Uses arequirements.txt
file located at the same level as the script to install additional dependencies. - Run an arbitrary container from a Dockerfile: Builds and runs a Docker container using a Dockerfile located in the specified path.
To run a Python script (with or without a requirements.txt
):
oneoff run my_scripy.py --name test-run
To run a Docker container from a Dockerfile located in the current directory:
oneoff run . --name test-run
To list all running oneoff jobs:
oneoff ls
This command displays the job name, status, and creation time of each running job.
To fetch the logs for a specific job:
oneoff logs -n job-name
To continuously tail the logs (real-time updates) for a job:
oneoff logs -n job-name -t
Note
Logs are automatically deleted after 7 days.
To kill a running job:
oneoff kill name_of_job
To remove old jobs from the ls
output and clean up metadata:
oneoff prune
To view the current configuration:
oneoff get_conf
When specifying CPU and memory, the combination of values supported can be found in the AWS docs here
Warning
The IAM role created for the task contains admin permissions for simplicity.