Skip to content

Commit ea82c9a

Browse files
Merge pull request #97 from AD-SDL/module_about
Add initial support for Module About specification
2 parents 64b5325 + e75769f commit ea82c9a

39 files changed

+1284
-737
lines changed

.github/workflows/docker-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Checkout repository
3232
uses: actions/checkout@v3
3333

34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v2
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v2
39+
3440
# Login against a Docker registry except on PR
3541
# https://github.com/docker/login-action
3642
- name: Log into registry ${{ env.REGISTRY }}
@@ -59,5 +65,6 @@ jobs:
5965
push: false
6066
tags: ${{ steps.meta.outputs.tags }}
6167
labels: ${{ steps.meta.outputs.labels }}
68+
platforms: linux/amd64,linux/arm64
6269
#cache-from: type=gha
6370
#cache-to: type=gha,mode=max

.github/workflows/docker-publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Checkout repository
3232
uses: actions/checkout@v3
3333

34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v2
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v2
39+
3440
# Login against a Docker registry except on PR
3541
# https://github.com/docker/login-action
3642
- name: Log into registry ${{ env.REGISTRY }}
@@ -59,5 +65,6 @@ jobs:
5965
push: true
6066
tags: ${{ steps.meta.outputs.tags }}
6167
labels: ${{ steps.meta.outputs.labels }}
68+
platforms: linux/amd64,linux/arm64
6269
#cache-from: type=gha
6370
#cache-to: type=gha,mode=max

.github/workflows/pypi-publish.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: PyPi Publish
22

33
on:
44
push:
5-
branches:
6-
- main
7-
tags: [ '*' ]
5+
tags: [ 'v*' ]
86

97
jobs:
108
publish_pypi:

.github/workflows/tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818
python-version: 3.9
1919
- name: Build the Project
2020
run: make init build
21-
- name: Start WEI
22-
run: make start
2321
- name: Test with pytest
2422
run: make test
2523
- name: Cleanup

Dockerfile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
FROM python:3.11
22

33
LABEL org.opencontainers.image.source=https://github.com/AD-SDL/wei
4-
LABEL org.opencontainers.image.description="The Workcell Execution Interface (WEI)"
4+
LABEL org.opencontainers.image.description="The Workflow Execution Interface (WEI)"
55
LABEL org.opencontainers.image.licenses=MIT
66

7+
RUN set -eux; \
8+
apt-get update; \
9+
apt-get install -y gosu; \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
# User configuration
713
ARG USER_ID=9999
814
ARG GROUP_ID=9999
915
ARG CONTAINER_USER=app
1016

11-
ADD https://github.com/FooBarWidget/matchhostfsowner/releases/download/v1.0.1/matchhostfsowner-1.0.1-x86_64-linux.gz /sbin/matchhostfsowner.gz
12-
RUN gunzip /sbin/matchhostfsowner.gz && \
13-
chown root: /sbin/matchhostfsowner && \
14-
chmod +x /sbin/matchhostfsowner
15-
1617
RUN groupadd -g ${GROUP_ID} ${CONTAINER_USER}
1718
RUN useradd --create-home -u ${USER_ID} --shell /bin/bash -g ${CONTAINER_USER} ${CONTAINER_USER}
1819

19-
USER ${CONTAINER_USER}
2020
WORKDIR /home/${CONTAINER_USER}
2121

2222
RUN mkdir -p wei/requirements
23-
RUN mkdir -p .wei/temp
24-
RUN mkdir .diaspora
23+
RUN mkdir -p .wei
24+
RUN mkdir -p .diaspora
2525

2626
# Install Python Dependencies first, for caching purposes
27-
COPY --chown=${USER_ID}:${GROUP_ID} requirements/requirements.txt wei/requirements/requirements.txt
28-
COPY --chown=${USER_ID}:${GROUP_ID} requirements/dev.txt wei/requirements/dev.txt
29-
RUN --mount=type=cache,target=/home/${CONTAINER_USER}/.cache,uid=${USER_ID},gid=${GROUP_ID} \
27+
COPY requirements/requirements.txt wei/requirements/requirements.txt
28+
COPY requirements/dev.txt wei/requirements/dev.txt
29+
RUN --mount=type=cache,target=/root/.cache \
3030
pip install -r wei/requirements/requirements.txt
3131

3232
# Copy wei files
33-
COPY --chown=${USER_ID}:${GROUP_ID} wei wei/wei
34-
COPY --chown=${USER_ID}:${GROUP_ID} tests wei/tests
35-
COPY --chown=${USER_ID}:${GROUP_ID} pyproject.toml wei/pyproject.toml
36-
COPY --chown=${USER_ID}:${GROUP_ID} README.md wei/README.md
37-
COPY --chown=${USER_ID}:${GROUP_ID} scripts wei/scripts
38-
COPY --chown=${USER_ID}:${GROUP_ID} workcell_defs wei/workcell_defs
33+
COPY wei wei/wei
34+
COPY tests wei/tests
35+
COPY pyproject.toml wei/pyproject.toml
36+
COPY README.md wei/README.md
37+
COPY scripts wei/scripts
38+
3939

4040
# Install dependencies and wei
41-
RUN --mount=type=cache,target=/home/${CONTAINER_USER}/.cache,uid=${USER_ID},gid=${GROUP_ID} \
41+
RUN --mount=type=cache,target=/root/.cache \
4242
pip install -e wei
4343

44-
USER root
45-
46-
ENTRYPOINT ["/sbin/matchhostfsowner"]
44+
COPY wei-entrypoint.sh /wei-entrypoint.sh
45+
RUN chmod +x /wei-entrypoint.sh
46+
ENTRYPOINT [ "/wei-entrypoint.sh" ]

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ $(DOCS): wei/* docs/source/*
2929

3030
publish: build publish-docker publish-python # Publishes the docker image and pypi package for wei
3131

32-
test: # Run Pytests
33-
docker compose -f $(COMPOSE_FILE) exec -u app $(APP_NAME) /bin/bash -c "pytest wei"
34-
3532
################################################################################
3633

3734
# Determine which rules don't correspond to actual files (add rules to NOT_PHONY to exclude)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- [![PyPI version](https://badge.fury.io/py/mdlearn.svg)](https://badge.fury.io/py/mdlearn) -->
55
<!-- [![Documentation Status](https://readthedocs.org/projects/mdlearn/badge/?version=latest)](https://mdlearn.readthedocs.io/en/latest/?badge=latest) -->
66

7-
The Workcell Execution Interface (WEI) for Autonomous Discovery/Self Driving Laboratories (AD/SDLs)
7+
The Workflow Execution Interface (WEI) for Autonomous Discovery/Self Driving Laboratories (AD/SDLs)
88

99
For more details and specific examples of how to use wei, please see our [documentation](https://rpl-wei.readthedocs.io/en/latest/).
1010

compose.yaml

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ services:
33
# Dev App #
44
###########
55
test_app:
6-
container_name: ${APP_NAME}
6+
container_name: test_app
7+
image: ${IMAGE_TEST}
78
build:
8-
context: .
9+
context: tests/
910
dockerfile: ${DOCKERFILE_TEST}
1011
volumes:
1112
- ${WORKCELLS_DIR}:/workcell_defs
@@ -14,16 +15,63 @@ services:
1415
- ${PROJECT_DIR}:/home/app/wei # for development only
1516
env_file:
1617
- .env
18+
profiles:
19+
- test
20+
command: pytest -p no:cacheprovider wei
1721
depends_on:
22+
- synthesis
23+
- transfer
24+
- measure
1825
- wei_server
1926
- wei_engine
2027
- wei_redis
21-
tty: true
28+
29+
###########
30+
# Modules #
31+
###########
32+
synthesis:
33+
image: ${IMAGE_TEST}
34+
container_name: synthesis
35+
ports:
36+
- 2000:2000
37+
command: 'python3 wei/tests/test_module/test_rest_node.py
38+
--port 2000
39+
--alias synthesis'
40+
env_file:
41+
- .env
42+
transfer:
43+
image: ${IMAGE_TEST}
44+
container_name: transfer
45+
ports:
46+
- 2001:2001
47+
command: 'python3 wei/tests/test_module/test_rest_node.py
48+
--port 2001
49+
--alias transfer'
50+
env_file:
51+
- .env
52+
measure:
53+
image: ${IMAGE_TEST}
54+
container_name: measure
55+
ports:
56+
- 2002:2002
57+
command: 'python3 wei/tests/test_module/test_rest_node.py
58+
--port 2002
59+
--alias measure'
60+
env_file:
61+
- .env
62+
2263
#####################
2364
# WEI Core Services #
2465
#####################
2566
wei_server:
2667
image: ${IMAGE}
68+
build:
69+
context: .
70+
dockerfile: ${DOCKERFILE}
71+
tags:
72+
- ${IMAGE}:latest
73+
- ${IMAGE}:${PROJECT_VERSION}
74+
- ${IMAGE}:dev
2775
container_name: wei_server
2876
ports:
2977
- 8000:8000
@@ -44,6 +92,8 @@ services:
4492
- ${WORKCELLS_DIR}:/workcell_defs
4593
- ${WEI_DATA_DIR}:/home/app/.wei
4694
- ${PROJECT_DIR}:/home/app/wei # for development only
95+
environment:
96+
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
4797
env_file:
4898
- .env
4999
command: python3 -m wei.engine --workcell /workcell_defs/${WORKCELL_FILENAME} --use_diaspora ${USE_DIASPORA}

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to the Workcell Execution Interface (WEI) Documentation!
6+
Welcome to the Workflow Execution Interface (WEI) Documentation!
77
================================================================
88

99
.. toctree::

make/config.mk

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
# Project Configuration
99
PROJECT_DIR := $(abspath $(MAKEFILE_DIR))
10-
WORKCELLS_DIR := $(PROJECT_DIR)/workcell_defs
10+
WORKCELLS_DIR := $(PROJECT_DIR)/tests/workcells
1111
WORKCELL_FILENAME := test_workcell.yaml
1212

1313
# Python Configuration
1414
PYPROJECT_TOML := $(PROJECT_DIR)/pyproject.toml
15-
PROJECT_VERSION := $(shell grep -oP '(?<=version = ")[^"]+' $(PYPROJECT_TOML) | head -n 1)
15+
PROJECT_VERSION := $(shell sed -n 's/version = "\([^"]*\)"/\1/p' $(PYPROJECT_TOML) | head -n 1)
1616

1717
# Docker Configuration
1818
COMPOSE_FILE := $(PROJECT_DIR)/compose.yaml
@@ -24,11 +24,10 @@ REGISTRY := ghcr.io
2424
ORGANIZATION := ad-sdl
2525
IMAGE_NAME := wei
2626
IMAGE := $(REGISTRY)/$(ORGANIZATION)/$(IMAGE_NAME)
27+
IMAGE_TEST := $(IMAGE)_test
2728

2829
# This should match the name of your app's service in the compose file
2930
APP_NAME := test_app
30-
# This should be the command to run your app in the container
31-
APP_COMMAND :=
3231
# This is where the data from the workcell will be stored
3332
# If these directories don't exist, they will be created
3433
WEI_DATA_DIR := $(PROJECT_DIR)/.wei
@@ -49,8 +48,6 @@ NOT_PHONY += .env
4948
@echo "# THIS FILE IS AUTOGENERATED, CHANGE THE VALUES IN THE MAKEFILE" > $(ENV_FILE)
5049
@echo "USER_ID=$(shell id -u)" >> $(ENV_FILE)
5150
@echo "GROUP_ID=$(shell id -g)" >> $(ENV_FILE)
52-
@echo "MHF_HOST_UID=$(shell id -u)" >> $(ENV_FILE)
53-
@echo "MHF_HOST_GID=$(shell id -g)" >> $(ENV_FILE)
5451
# The following adds every variable in the Makefiles to the .env file,
5552
# except for everything in ENV_FILTER and ENV_FILTER itself
5653
@$(foreach v,\

0 commit comments

Comments
 (0)