Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jay/vs code integration #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.json
*.tar
checkpoints*
venv*
Expand Down
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
79 changes: 79 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
29 changes: 22 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
FROM python:3.7

Maintainer MSREnable
LABEL org.opencontainers.image.authors="[email protected]"

# 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
ENTRYPOINT ["python"]
5 changes: 4 additions & 1 deletion taskCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down