diff --git a/.github/workflows/ci-k8s.yaml b/.github/workflows/ci-k8s.yaml new file mode 100644 index 0000000000..457b81d948 --- /dev/null +++ b/.github/workflows/ci-k8s.yaml @@ -0,0 +1,54 @@ +name: Parsl + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + k8s-kind-suite: + runs-on: ubuntu-24.04 + timeout-minutes: 60 + + steps: + - uses: actions/checkout@master + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1 + with: + # kind tooling uses this name by default, but kind-action uses + # a different default name + cluster_name: kind + + - name: Build docker image + uses: docker/build-push-action@v5 + with: + context: . + file: parsl/tests/ci_k8s/Dockerfile + tags: parsl:ci + + - name: Push docker image into kubernetes cluster + run: | + kind load docker-image parsl:ci + + - name: set liberal permissions + run: | + kubectl create clusterrolebinding serviceaccounts-cluster-admin --clusterrole=cluster-admin --group=system:serviceaccounts + + - name: launch pytest Job + run: | + free -h + kubectl create -f parsl/tests/ci_k8s/pytest-task.yaml + + - name: wait for pytest Job + run: | + kubectl wait --timeout=600s --for=condition=Complete Job pytest + + - name: report some info + if: ${{ always() }} + run: | + free -h + kubectl describe pods + kubectl describe jobs + kubectl logs --timestamps Job/pytest diff --git a/parsl/tests/ci_k8s/Dockerfile b/parsl/tests/ci_k8s/Dockerfile new file mode 100644 index 0000000000..0e9b3dff64 --- /dev/null +++ b/parsl/tests/ci_k8s/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:bookworm + +RUN apt-get update && apt-get upgrade -y + +# git is needed for parsl to figure out it's own repo-specific +# version string, from the github-checked-out repo + +# gcc and similar are needed for building taskvine + +RUN apt-get update && apt-get install -y git procps python3 python3-dev python3-venv gcc build-essential make pkg-config mpich swig + +RUN python3 -m venv /venv + +ADD . /parsl +WORKDIR / +RUN git clone https://github.com/cooperative-computing-lab/cctools --depth 1 -b release/7.8.0 + +WORKDIR /cctools +RUN . /venv/bin/activate && ./configure --prefix=/ && make && make install + +WORKDIR /parsl +RUN . /venv/bin/activate && pip3 install '.[kubernetes]' cloudpickle -r test-requirements.txt + diff --git a/parsl/tests/ci_k8s/__init__.py b/parsl/tests/ci_k8s/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/parsl/tests/ci_k8s/htex_k8s_kind.py b/parsl/tests/ci_k8s/htex_k8s_kind.py new file mode 100644 index 0000000000..3be29bd63c --- /dev/null +++ b/parsl/tests/ci_k8s/htex_k8s_kind.py @@ -0,0 +1,24 @@ +from parsl.config import Config +from parsl.executors import HighThroughputExecutor +from parsl.launchers import SimpleLauncher +from parsl.providers import KubernetesProvider + + +def fresh_config(): + return Config( + executors=[ + HighThroughputExecutor( + label="executorname", + storage_access=[], + worker_debug=True, + cores_per_worker=1, + encrypted=False, # needs certificate fs to be mounted in same place... + provider=KubernetesProvider(worker_init=". /venv/bin/activate", + image="parsl:ci", + max_mem="2048Gi" + # was getting OOM-killing of workers with default... this helps + ), + ) + ], + strategy='none', + ) diff --git a/parsl/tests/ci_k8s/pytest-task.yaml b/parsl/tests/ci_k8s/pytest-task.yaml new file mode 100644 index 0000000000..65bfca4e47 --- /dev/null +++ b/parsl/tests/ci_k8s/pytest-task.yaml @@ -0,0 +1,15 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: pytest +spec: + activeDeadlineSeconds: 600 + backoffLimit: 0 + template: + spec: + restartPolicy: Never + containers: + - name: pytest + image: parsl:ci + command: ["bash", "/parsl/parsl/tests/ci_k8s/runme.sh"] + diff --git a/parsl/tests/ci_k8s/runme.sh b/parsl/tests/ci_k8s/runme.sh new file mode 100644 index 0000000000..e632ec8ce1 --- /dev/null +++ b/parsl/tests/ci_k8s/runme.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +source /venv/bin/activate + +pytest parsl/tests/ --config parsl/tests/ci_k8s/htex_k8s_kind.py -k 'not issue3328 and not staging_required and not shared_fs' -x --random-order + +PYTHONPATH=/usr/lib/python3.11/site-packages/ pytest parsl/tests/ --config parsl/tests/ci_k8s/taskvine_k8s_kind.py -k 'not issue3328 and not staging_required and not shared_fs' -x --random-order --log-cli-level=DEBUG diff --git a/parsl/tests/ci_k8s/taskvine_k8s_kind.py b/parsl/tests/ci_k8s/taskvine_k8s_kind.py new file mode 100644 index 0000000000..6deb60d38d --- /dev/null +++ b/parsl/tests/ci_k8s/taskvine_k8s_kind.py @@ -0,0 +1,16 @@ +from parsl.addresses import address_by_hostname +from parsl.config import Config +from parsl.executors.taskvine import TaskVineExecutor, TaskVineManagerConfig +from parsl.launchers import SimpleLauncher +from parsl.providers import KubernetesProvider + + +def fresh_config(): + return Config(executors=[TaskVineExecutor(manager_config=TaskVineManagerConfig(address=address_by_hostname(), port=9000), + worker_launch_method='provider', + provider=KubernetesProvider(worker_init=". /venv/bin/activate", + image="parsl:ci", + max_mem="2048Gi" + ), + + )])