Page MenuHomePhabricator

Design task/job queue for task runs for initial phase of project
Open, Needs TriagePublic

Description

Acceptance Criteria

Notes

  • Will use celery as primary application-layer task manager
  • Will like use the docker sdk as well, for tool interactions

Amusingly, Google's AI results have a decent (though overly-simplistic) coding solution:

from celery import Celery
import docker

app = Celery('tasks', broker='redis://localhost:6379/0')

@app.task
def run_docker_container(image_name, command):
    client = docker.from_env()
    container = client.containers.run(
        image_name, 
        command, 
        detach=True, 
        remove=True
    )
    return container.id
from tasks import run_docker_container

result = run_docker_container.delay('alpine', 'echo "Hello from Docker!"')

Related Objects