Skip to content
Snippets Groups Projects
Commit cb92ba07 authored by nguyed99's avatar nguyed99
Browse files

Update repo structure

parent 98fca14c
No related branches found
No related tags found
No related merge requests found
......@@ -30,27 +30,24 @@ All folders are isolated projects. `cd` into the folder to run/build them.
*Some Project Access Tokens are available and will be provided to members.*
## Local development
### jobs
### jobs and tasks
Jobs are run inside of docker containers. There is a docker build script (`Dockerfile`) and can be run in `dev` mode via `docker run`. Please be aware it can take a while to build the initial image.
Jobs and tasks are run inside of docker containers. There is a docker build script (`Dockerfile`) and can be run in `dev` mode via `docker run`. Please be aware it can take a while to build the initial image. At root directory, to build the image run:
cd jobs
bash build/build_image.sh
The image is built now and ready to be used! The tests in the Docker container built from the image can be sanity-checked via (test implementation without minio-s3-parameter transport):
The image is built now and ready to be used! The tests in the Docker container built from the image can be sanity-checked via :
docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs:local python unittests/test_a_job.py
docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local python jobs/unittests/test_a_job.py
For live experience (meaning you enter the container), run:
docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs:local /bin/bash
or for testing a task:
If you change code in `src`, you need to rebuild the image with `bash build/build_image.sh`. The `src` folder can also be mounted in the image, but the assumption is that life is already difficult as it is...
docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local python tasks/integration-tests/test_a_task.py
### tasks (! Under construction !)
For live experience (meaning you enter the container), run:
Tasks are python scripts that can spawn jobs which run in docker containers. Before calling a task, make sure you have built the related job-image.
docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local /bin/bash
python -B src/a_task.py local --config=docker.yaml --IN0 demo-inputs/system.json --OUT /tmp/test-a-task
If you change code in `src`, you need to rebuild the image with `bash build/build_image.sh`. The `src` folder can also be mounted in the image, but the assumption is that life is already difficult as it is...
*Free and open-source software for all souls! Technical support is, unfortunately, only for group members.*
\ No newline at end of file
......@@ -51,10 +51,10 @@ RUN curl -sSL https://install.python-poetry.org | python -
# ------------------------------------------------------------
WORKDIR /usr/src/app
ADD pyproject.toml .
ADD build/pyproject.toml .
ADD src ./src
ADD unittests ./unittests
ADD tasks/ ./tasks
ADD jobs/ ./jobs
RUN poetry install --only main --compile -vv
......@@ -81,7 +81,9 @@ COPY --from=packaging /usr/src/app /usr/src/app
WORKDIR /usr/src/app
ENV PATH="/usr/src/app/.venv/bin:$PATH"
# Add the src directory to PYTHONPATH
ENV PYTHONPATH="/usr/src/app/src:${PYTHONPATH}"
# Add the src directories to PYTHONPATH
ENV PYTHONPATH="/usr/src/app/jobs/src:${PYTHONPATH}"
ENV PYTHONPATH="/usr/src/app/tasks/src:${PYTHONPATH}"
CMD ["python"]
......@@ -4,7 +4,9 @@ set -e
CWD=$(cd $(dirname $0); pwd)
REGISTRY=git.imp.fu-berlin.de:5000/comp-sci-project
IMAGE=${REGISTRY}/jobs:${RELEASE:-local}
# REGISTRY=git.imp.fu-berlin.de:5000/nguyed99/comp-sci-project
IMAGE=${REGISTRY}/jobs-n-tasks:${RELEASE:-local}
BASE_VERSION="3.11.5-slim"
echo Building $IMAGE
......@@ -16,3 +18,5 @@ docker build \
--build-arg BASE_VERSION=$BASE_VERSION \
-t $IMAGE \
"$CWD/.."
# docker push $IMAGE
\ No newline at end of file
File moved
version: '3.4'
services:
minio:
image: minio/minio
container_name: minio-s3
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- '9000:9000'
- '9001:9001'
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
# let docker handle persistence of the data directory
volumes:
minio_data: {}
\ No newline at end of file
......@@ -3,7 +3,7 @@ import unittest
import numpy as np
from src.a_job import sigma_x, sigma_y, sigma_z
from jobs.src.a_job import sigma_x, sigma_y, sigma_z
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
......
backend:
name: docker-dev
kind: docker
release: local
transport:
name: minio
kind: s3
url: s3+http://minioadmin:minioadmin@127.0.0.1:9000/test
remoteUrl: s3+http://minioadmin:minioadmin@127.0.0.1:9000/test
imageSpecs:
"git.imp.fu-berlin.de:5000/comp-sci-project:local":
network_mode: host
volumes:
../jobs/src:
bind: /usr/src/app/src
mode: ro
defaultSpecs:
network_mode: host
maxCpu: 4
plugins:
- kind: logging
- kind: resources
- kind: metrics
name: honeycomb
host: https://api.honeycomb.io
apiKey: 1X7YfLO8iH3zevALRjxL5F
dataset: honeycomb-python-example
- kind: storage
numJobs: 3
......@@ -3,7 +3,7 @@ import unittest
import numpy as np
from src.a_task import swap_gate
from tasks.src.a_task import swap_gate
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
......
......@@ -11,6 +11,6 @@ from jobs.src.a_job import sigma_x, sigma_y, sigma_z
def swap_gate() -> np.ndarray:
swap_matrix = (np.kron(np.identity(2), np.identity(2)) + np.kron(sigma_x(), sigma_x()) +
swap_matrix = 1 / 2 * (np.kron(np.identity(2), np.identity(2)) + np.kron(sigma_x(), sigma_x()) +
np.kron(sigma_y(), sigma_y()) + np.kron(sigma_z(), sigma_z()))
return swap_matrix
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment