diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..da7fe8e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ +**/__pycache__ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/.gitignore b/.gitignore index 7fc2a18..9d18e98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -*.json *.tar checkpoints* venv* diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6338a2e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,19 @@ +{ + "configurations": [ + { + "name": "Step 1: ROI Detection", + "type": "docker", + "request": "launch", + "preLaunchTask": "Step 1: ROI Detection", + "python": { + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/app" + } + ], + "projectType": "general" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..00de118 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,79 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "docker-build", + "type": "docker-build", + "platform": "python", + "dockerBuild": { + "tag": "gazecapture:latest", + "dockerfile": "${workspaceFolder}/Dockerfile", + "context": "${workspaceFolder}", + "pull": true + } + }, + { + "type": "docker-run", + "label": "Step 1: ROI Detection", + "dependsOn": [ + "docker-build" + ], + "python": { + "args": ["--task", "'ROIDetectionTask'", "--input", "/data/200407", "--output", "/data/meta"], + "file": "taskCreator.py" + }, + "dockerRun": { + "volumes": [ + { + "localPath": "/var/run/docker.sock", + "containerPath": "/var/run/docker.sock" + }, + { + "localPath": "/data", + "containerPath": "/data" + }, + { + "localPath": "${workspaceFolder}", + "containerPath": "/app" + } + ] + } + }, + { + "type": "docker-run", + "label": "Step 2: ROI Extraction", + "dependsOn": [ + "docker-build" + ], + "python": { + "args": ["--task", "'ROIExtraction'", "--input", "/data/200407", "--metapath", "/data/meta", "--output", "/data/prepped"], + "file": "taskCreator.py" + }, + "dockerRun": { + "volumes": [ + { + "localPath": "/var/run/docker.sock", + "containerPath": "/var/run/docker.sock" + }, + { + "localPath": "/data", + "containerPath": "/data" + }, + { + "localPath": "${workspaceFolder}", + "containerPath": "/app" + } + ] + } + }, + { + "type": "docker-run", + "label": "Step 3: train (reset)", + "dependsOn": ["docker-build"], + "python": { + "args": ["--data_path", "/data/prepped", "--reset"], + "file": "main.py" + } + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6e7b2b8..60a64a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,34 @@ FROM nvidia/cuda:11.2.2-devel-ubuntu20.04 FROM python:3.7 -Maintainer MSREnable +LABEL org.opencontainers.image.authors="MSREnable@Microsoft.Com" + +# Keeps Python from generating .pyc files in the container +ENV PYTHONDONTWRITEBYTECODE=1 +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 +# nvidia-container-runtime +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES all RUN apt-get update && apt-get install -y build-essential cmake apt-utils RUN pip3 install --upgrade pip -COPY ./requirements.txt ./requirements.txt +COPY requirements.txt . RUN pip3 install -r requirements.txt +VOLUME [ "/app" ] # Dynamically mounted from the host +VOLUME [ "/data" ] # Dynamically mounted from the host + +# COPY . /app # Now dynamically mounted from the host +WORKDIR /app + +# Creates a non-root user with an explicit UID and adds permission to access the /app folder +# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers +RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app +USER appuser + EXPOSE 8097 # Execute the python -ENTRYPOINT ["python"] - -# nvidia-container-runtime -ENV NVIDIA_VISIBLE_DEVICES all -ENV NVIDIA_DRIVER_CAPABILITIES all \ No newline at end of file +ENTRYPOINT ["python"] \ No newline at end of file diff --git a/taskCreator.py b/taskCreator.py index b25d12b..be1858d 100644 --- a/taskCreator.py +++ b/taskCreator.py @@ -1680,7 +1680,10 @@ def userCalibrationTask(filepath): dataLoader = None # run the job - output = taskManager.job(taskFunction, taskData, dataLoader) + # output = taskManager.job(taskFunction, taskData, dataLoader, 1) + + # temporarily single thread this to simplify debugging + output = taskManager.job(taskFunction, taskData, dataLoader, 1) # post-processing after the task has completed if args.task == "CaptureDataDistributionTask":