Skip to content

Commit

Permalink
fixed bugs for running docker in docker.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimiao1025 committed Mar 6, 2024
1 parent 7bacffa commit da6b1d0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 22 deletions.
20 changes: 2 additions & 18 deletions api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,8 @@ async def analysis_task(requests: List[Dict[str, Any]]):
return {"task_id": task.id}

@app.post(f"/submit")
async def submit_task(
request: Request,
pdb_path: Union[str, Path] = None,
plddt: float = 0.0,
target_addresses: str = "",
):
_params = request.json()
print("Request: ", _params)
HASH_ID = "hash_id"
if _params is None or HASH_ID not in _params:
return json.dumps([])
hash_ids = _params[HASH_ID]
if not isinstance(hash_ids, list):
hash_ids = [hash_ids]

task = celery_client.send_task(
"submit", args=[pdb_path, plddt, target_addresses], queue="queue_submit"
)
async def submit_task(requests: List[Dict[str, Any]]):
task = celery_client.send_task("submit", args=[requests], queue="queue_submit")
return {"task_id": task.id}


Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ services:
- CELERY_BROKER_URL=amqp://rabbitmq:5672
- CELERY_RESULT_BACKEND=redis://redis
volumes:
- /var/run/docker.sock:/var/run/docker.sock # run docker in docker
- ./services/searchtpl:/worker
- /data:/data
- ./lib:/worker/lib
Expand Down
2 changes: 1 addition & 1 deletion gui/stats.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions services/analysis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ENV CELERY_BROKER_URL pyamqp://guest:guest@localhost:5672/
ENV CELERY_RESULT_BACKEND rpc://
ENV C_FORCE_ROOT true

# RUN apk add build-base linux-headers # very slow
COPY requirements.txt /tmp/requirements.txt

RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Expand Down
2 changes: 1 addition & 1 deletion services/analysis/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,4 @@ def run(self, *args, dry=False, **kwargs):
)
result_path = os.path.join(dirname, "plddt_results.json")
dtool.write_json(result_path, data=model2plddts)
return True
# return True
10 changes: 10 additions & 0 deletions services/searchtpl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -U setuptools pip
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Install docker (to make docker in docker work)
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable"
| tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /worker

# Specify the command to run on container start
Expand Down
1 change: 1 addition & 0 deletions services/submit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9

ENV CELERY_BROKER_URL pyamqp://guest:guest@localhost:5672/
ENV CELERY_RESULT_BACKEND rpc://
ENV C_FORCE_ROOT true
Expand Down
2 changes: 1 addition & 1 deletion services/submit/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,4 @@ def init_runners(self, groups):
def run(self, dry=False, *args, **kwargs):
for runner in self.runners:
runner.run(dry=dry)
return True
# return True
4 changes: 3 additions & 1 deletion services/tplfeature/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ py3Dmol
psutil
gpustat
absl-py
docker
docker
ray
dm-tree

0 comments on commit da6b1d0

Please sign in to comment.