Skip to content

Commit

Permalink
Dashboard (#9)
Browse files Browse the repository at this point in the history
* Locally working dynamic settings version

* Bump version

* Fix waiting settings file

* Rename config file to settings.json

* Bump version

* Switch to alpine node

* Working version of dashboard

* Remove the ability to change the job status

* Add hover boxes etc

* Use light grey for todo in dashboard

* Changed direction of progress bar
  • Loading branch information
wvangeit authored Aug 19, 2024
1 parent a6f1071 commit 6c6b713
Show file tree
Hide file tree
Showing 25 changed files with 663 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.1
current_version = 1.0.1
commit = False
message = service version: {current_version} → {new_version}
tag = False
Expand Down
24 changes: 6 additions & 18 deletions .osparc/osparc-meta-parallelrunner/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ParallelRunner
description: "ParallelRunnerService"
key: simcore/services/dynamic/osparc-meta-parallelrunner
version: 0.2.1
version: 1.0.1
integration-version: 2.0.0
type: dynamic
authors:
Expand All @@ -10,30 +10,18 @@ authors:
affiliation: IT'IS Foundation
contact: [email protected]
inputs:
input_0:
displayOrder: 0.0
label: Template ID
description:
Template ID
type: string
input_1:
displayOrder: 1.0
label: Number of workers
displayOrder: 0.0
label: Settings
description:
Number of parallel workers to use to run the jobs
type: integer
JSON file with settings for the parallel runner
type: data:*/*
input_2:
displayOrder: 2.0
displayOrder: 1.0
label: Input parameters
description:
File with the parameter sets to evaluate
type: data:*/*
input_3:
displayOrder: 2.0
label: Settings
description:
JSON file with settings for the parallel runner
type: data:*/*
outputs:
output_1:
displayOrder: 1.0
Expand Down
32 changes: 23 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
FROM ubuntu:22.04 as base
FROM node:alpine as base

RUN useradd -m -r osparcuser
RUN adduser osparcuser --disabled-password

USER root

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS="yes"

RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install --yes --no-install-recommends python3 python-is-python3 python3-venv wget python3-pip gosu

RUN apk update && apk upgrade
RUN apk add --no-cache python3 py3-pip wget bash su-exec

# Copying boot scripts
COPY docker_scripts /docker

RUN pip3 install pathos osparc pydantic-settings osparc-filecomms --upgrade

USER osparcuser

WORKDIR /home/osparcuser
RUN python3 -m venv venv
RUN . ./venv/bin/activate && pip3 install -r /docker/requirements.txt

USER root

WORKDIR /docker/http
RUN npm install vite @vitejs/plugin-react --save-dev
RUN npm create vite@latest dashboard -- --template react

WORKDIR /docker/http/dashboard
RUN npm install
RUN npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
RUN npx tailwindcss init -p

WORKDIR /docker/http/server
RUN chown osparcuser:osparcuser jobs.json

RUN npm install express
RUN npm run build

USER root
EXPOSE 8888
ENV JOBS_STATUS_PATH=/docker/http/server/jobs.json

ENTRYPOINT [ "/bin/bash", "-c", "/docker/entrypoint.bash" ]
CMD [ "/bin/bash", "-c", "/docker/runner.bash "]
25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SHELL = /bin/sh
MAKEFLAGS += -j2

export DOCKER_IMAGE_NAME ?= osparc-meta-parallelrunner
export DOCKER_IMAGE_TAG ?= 0.2.1
export DOCKER_IMAGE_TAG ?= 1.0.1

export MASTER_AWS_REGISTRY ?= registry.osparc-master-zmt.click
export MASTER_REGISTRY ?= registry.osparc-master.speag.com
Expand Down Expand Up @@ -35,25 +35,25 @@ compose-spec: ## runs ooil to assemble the docker-compose.yml file
sh -c "cd /${DOCKER_IMAGE_NAME} && ooil compose"

clean:
rm -rf docker-compose.yml
@rm -rf docker-compose.yml

.PHONY: build
build: clean compose-spec ## build docker image
chmod -R 755 docker_scripts
docker compose build
@chmod -R 755 docker_scripts
@docker compose build

validation-clean:
rm -rf validation-tmp
cp -r validation validation-tmp
chmod -R 770 validation-tmp
@rm -rf validation-tmp
@cp -r validation validation-tmp
@chmod -R 770 validation-tmp

validation_client_run: validation-clean
pip install osparc-filecomms
VALIDATION_CLIENT_INPUT_PATH=validation-tmp/outputs/output_1 VALIDATION_CLIENT_OUTPUT_PATH=validation-tmp/inputs/input_2 python validation-client/client.py
@pip install osparc-filecomms
@VALIDATION_CLIENT_INPUT_PATH=validation-tmp/outputs/output_1 VALIDATION_CLIENT_OUTPUT_PATH=validation-tmp/inputs/input_2 python validation-client/client.py

docker_compose: validation-clean
docker compose down
docker compose --file docker-compose-local.yml up
@docker compose down
@docker compose --file docker-compose-local.yml up

run-local-parallel: docker_compose validation_client_run

Expand All @@ -65,13 +65,11 @@ run-local: build
publish-local: run-local ## push to local throw away registry to test integration
docker tag simcore/services/dynamic/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} $(LOCAL_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
docker push $(LOCAL_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
@curl $(LOCAL_REGISTRY)/v2/_catalog | jq

.PHONY: publish-master
publish-master: run-local ## push to local throw away registry to test integration
docker tag simcore/services/dynamic/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} $(MASTER_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
docker push $(MASTER_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
@curl $(MASTER_REGISTRY)/v2/_catalog | jq

.PHONY: publish-staging
publish-staging: run-local ## push to local throw away registry to test integration
Expand All @@ -82,7 +80,6 @@ publish-staging: run-local ## push to local throw away registry to test integrat
publish-master-aws: ## push to local throw away registry to test integration
docker tag simcore/services/dynamic/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} $(MASTER_AWS_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
docker push $(MASTER_AWS_REGISTRY)/simcore/services/dynamic/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
@curl $(MASTER_AWS_REGISTRY)/v2/_catalog | jq

.PHONY: help
help: ## this colorful help
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
osparc-meta-parallelrunner:
image: simcore/services/dynamic/osparc-meta-parallelrunner:0.2.1
image: simcore/services/dynamic/osparc-meta-parallelrunner:1.0.1
ports:
- "8888:8888"
environment:
Expand Down
9 changes: 6 additions & 3 deletions docker_scripts/entrypoint.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash

set -euo pipefail

IFS=$'\n\t'
INFO="INFO: [$(basename "$0")] "

echo "$INFO" "Starting container for parallelrunner ..."

echo "$JOBS_STATUS_PATH"

HOST_USERID=$(stat -c %u "${DY_SIDECAR_PATH_INPUTS}")
HOST_GROUPID=$(stat -c %g "${DY_SIDECAR_PATH_INPUTS}")
CONTAINER_GROUPNAME=$(getent group | grep "${HOST_GROUPID}" | cut --delimiter=: --fields=1 || echo "")
CONTAINER_GROUPNAME=$(grep ":${HOST_GROUPID}:" /etc/group | cut -d: -f1 || echo "")

OSPARC_USER='osparcuser'

Expand All @@ -27,7 +30,7 @@ else
fi

echo "adding $OSPARC_USER to group $CONTAINER_GROUPNAME..."
usermod --append --groups "$CONTAINER_GROUPNAME" "$OSPARC_USER"
addgroup "$OSPARC_USER" "$CONTAINER_GROUPNAME"

echo "changing owner ship of state directory /home/${OSPARC_USER}/work/workspace"
chown --recursive "$OSPARC_USER" "/home/${OSPARC_USER}/work/workspace"
Expand All @@ -37,4 +40,4 @@ else
chown --recursive "$OSPARC_USER" "${DY_SIDECAR_PATH_OUTPUTS}"
fi

exec gosu "$OSPARC_USER" /docker/main.bash
exec su-exec "$OSPARC_USER" /docker/main.bash
12 changes: 12 additions & 0 deletions docker_scripts/http/dashboard/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Job Status Dashboard</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions docker_scripts/http/dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "job-status-dashboard",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0"
}
}
Loading

0 comments on commit 6c6b713

Please sign in to comment.