This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from QGreenland-Net/run-parsl-on-adc-cluster
WIP set up process to run the Parsl script as a k8s Job
- Loading branch information
Showing
6 changed files
with
94 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Build and publish container image" | ||
|
||
on: | ||
push: | ||
paths: | ||
- "Dockerfile" | ||
- "environment.yml" | ||
branches: | ||
- "main" | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
|
||
|
||
jobs: | ||
|
||
build-and-release-image: | ||
name: "Build and release container image" | ||
runs-on: "ubuntu-latest" | ||
env: | ||
# IMAGE_NAME: "${{ github.repo_name_or_something_like_that }}" | ||
# NOTE: It's important that the image name matches org name / repo name. | ||
# TODO: Calculate image name? | ||
IMAGE_NAME: "qgreenland-net/parsl-exploration" | ||
# GitHub Actions expressions don't have great conditional support, so | ||
# writing a ternary expression looks a lot like bash. In Python, this | ||
# would read as: | ||
# github.ref_name if github.ref_type == 'tag' else 'latest' | ||
# https://docs.github.com/en/actions/learn-github-actions/expressions | ||
IMAGE_TAG: "${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}" | ||
steps: | ||
- name: "Check out repository" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: "Build container image" | ||
run: | | ||
docker build --tag "ghcr.io/${IMAGE_NAME}:${IMAGE_TAG}" . | ||
- name: "GHCR login" | ||
uses: "docker/login-action@v2" | ||
with: | ||
registry: "ghcr.io" | ||
username: "${{ github.repository_owner }}" | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: "Push to GHCR" | ||
run: | | ||
docker push "ghcr.io/${IMAGE_NAME}:${IMAGE_TAG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM mambaorg/micromamba:1.5.8 AS micromamba | ||
|
||
COPY --chown=$MAMBA_USER:$MAMBA_USER . . | ||
|
||
RUN micromamba install --yes --name "base" --file "environment.yml" | ||
RUN micromamba clean --all --yes | ||
|
||
# ENV PATH "/opt/conda/bin:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Send our Parsl init script to the cluster. This will update the ConfigMap if | ||
# there are any changes. Note that "age" represents the time since the | ||
# ConfigMap was created, not since it was last updated. | ||
kubectl create configmap parsl-init-script --from-file run.py \ | ||
-o yaml --dry-run=client \ | ||
| kubectl apply -f - | ||
|
||
# Submit a "Job" to the cluster which runs our script | ||
# TODO: Should we delete any pre-existing job? We're manually doing `kubectl delete` now. | ||
kubectl apply -f job.yml | ||
|
||
|
||
# TODO: Can we also attach to monitor `kubectl describe job` or something? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters