Commit fab73f7e authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

add MAX_JOBS to configure the number of concurrent jobs

parent 5fe27202
......@@ -20,6 +20,7 @@ EXPOSE 4567
ENV PORT="4567" \
ENV="" \
REGISTRY="" \
MAX_JOBS="4" \
DATASTORE_PATH="/data/{ENV}/rails/rw/datastore/" \
SANDBOX_PATH="/data/{ENV}/ssh/cache/sandbox/" \
DOCKER_HOST="unix:///run/docker.sock" \
......
......@@ -739,8 +739,8 @@ EOF
class JobManager(Manager):
def __init__(self, ctrl, nb_threads=NB_JOB_TASKS):
super().__init__(nb_threads)
def __init__(self, ctrl, nb_jobs=NB_JOB_TASKS):
super().__init__(nb_jobs)
self.ctrl = ctrl
def _run_job(self, job_id, ver_id):
......@@ -1036,7 +1036,8 @@ class ImageManager:
class DockerController:
def __init__(self, sandbox_host, swarm_host, mysql_host,
port, registry, env, datastore_path, sandbox_path):
port, registry, env, datastore_path, sandbox_path,
max_jobs):
self.sandbox = docker.Client(sandbox_host)
self.swarm = self.sandbox if sandbox_host == swarm_host else docker.Client(swarm_host)
......@@ -1053,7 +1054,7 @@ class DockerController:
self.image_manager = ImageManager(self)
self.sandbox_manager = SandboxManager(self)
self.job_manager = JobManager(self)
self.job_manager = JobManager(self, max_jobs)
self.registry = registry
self.env = env
......
......@@ -154,6 +154,7 @@ class ControllerTestCase(unittest.TestCase):
env = ENV,
datastore_path = "/data/dev/cache/test/datastore",
sandbox_path = "/data/dev/ssh/cache/sandbox",
max_jobs = 4,
)
@classmethod
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment