-
Notifications
You must be signed in to change notification settings - Fork 2
Targets-based workflows leveraging slurm for dist. computing - workflow 1a and POC #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hdpriest-ui
wants to merge
29
commits into
ccmmf:main
Choose a base branch
from
hdpriest-ui:abstracted_workflows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d47542e
basic changes before moving to cluster
hdpriest-ui 6996c16
basic workflow run layout. functional in basic sense. checkpoint comm…
hdpriest-ui 8b33eca
nearly functional; workflows now run in tagged subdirectories and are…
hdpriest-ui 1165b76
Remove deprecated target files and add new workflow scripts for data …
hdpriest-ui ab24fbf
Targets+Slurm functional for workflow 1a
hdpriest-ui edf8ffc
Added workflows for GHA
hdpriest-ui d42d6b6
updated base sipnet image name
hdpriest-ui 4b0d138
updated apptainer sif name in XML settings file
hdpriest-ui 3219990
Update tools/workflow_functions.R
hdpriest-ui c7177a8
interim commit of readme materials to enable offline dev; readme not …
hdpriest-ui c71a29d
Merge branch 'abstracted_workflows' of https://github.com/hdpriest-ui…
hdpriest-ui 01af278
Documentation update for basic data prep, data reference, and running…
hdpriest-ui 1865b47
Interup updates for orchestration version of 2a workflow
hdpriest-ui 0765132
fix attempt to pass model-version correctly
hdpriest-ui cb62d1c
probably foolhardy - attempt to fix sipnet build and also reference p…
hdpriest-ui e10a77a
making dockerfile less flexible
hdpriest-ui 3b18c6c
remove targeting of pecan repo's builder
hdpriest-ui 02105ea
added image version to the builder yaml; diverging it further from pe…
hdpriest-ui fff20cf
-removed now-extraneous 1a_workflowed directory
hdpriest-ui 6b3de57
- added stanza for XML build step
hdpriest-ui 0463d36
Merge branch 'ccmmf:main' into abstracted_workflows
hdpriest-ui 235a08f
Major improvements to target pipelines
hdpriest-ui cf9d24d
- added adapters for 2a workflow steps. these connect original CLI ar…
hdpriest-ui f4aee4e
- commit for missing change
hdpriest-ui ddd80d5
fix attempt 1 - runs on change
hdpriest-ui 12c9ffe
fix attempt - next
hdpriest-ui 307811f
- added necessary XMLs to workflow resources dir
hdpriest-ui 8136e23
path fix for XML location - this needs a heavier pass to resolve more…
hdpriest-ui 871de55
another path fix.
hdpriest-ui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,163 @@ | ||
| name: build-image | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| image-name: | ||
| required: true | ||
| type: string | ||
| build-context: | ||
| required: true | ||
| type: string | ||
| dockerfile: | ||
| required: true | ||
| type: string | ||
| r-version: | ||
| required: true | ||
| type: string | ||
| parent-image: | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| model-version: | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| image-version: | ||
| required: false | ||
| default: "latest" | ||
| type: string | ||
| dockerhub-repo: | ||
| required: false | ||
| default: "hdpriest0uiuc" | ||
| type: string | ||
| platforms: | ||
| required: false | ||
| default: "linux/amd64" | ||
| type: string | ||
| secrets: | ||
| DOCKERHUB_USERNAME: | ||
| description: 'DockerHub username used to push images' | ||
| required: false | ||
| DOCKERHUB_PASSWORD: | ||
| description: 'DockerHub password used to push images' | ||
| required: false | ||
|
|
||
| env: | ||
| DEFAULT_R_VERSION: "4.4" | ||
| GITHUB_PAT: ${{ secrets.GH_TOKEN }} | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| packages: write | ||
|
|
||
| steps: | ||
|
|
||
| - name: lowercase image name | ||
| id: name | ||
| run: | | ||
| echo "image_name=$(echo ${{ inputs.image-name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | ||
| echo "repository=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: set PARENT_IMAGE only if specified | ||
| id: parent | ||
| shell: bash | ||
| run: | | ||
| echo "PARENT_IMAGE_IF_SET=$( | ||
| [[ -n '${{ inputs.parent-image }}' ]] && | ||
| echo "PARENT_IMAGE=ghcr.io/${{ steps.name.outputs.repository }}/"'${{ inputs.parent-image }}' | ||
| )" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: set MODEL_VERSION only if specified | ||
| id: modelver | ||
| shell: bash | ||
| run: | | ||
| echo "MODEL_VERSION_IF_SET=$( | ||
| [[ -n '${{ inputs.model-version }}' ]] && | ||
| echo 'MODEL_VERSION=${{ inputs.model-version }}' | ||
| )" >> $GITHUB_OUTPUT | ||
|
|
||
| - uses: actions/checkout@v4 | ||
|
|
||
| # create metadata for image | ||
| - name: Docker meta | ||
| env: | ||
| check_var: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| is_default_R: ${{ inputs.r-version == env.DEFAULT_R_VERSION }} | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| # list of Docker images to use as base name for tags | ||
| images: | | ||
| name=ghcr.io/${{ steps.name.outputs.repository }}/${{ steps.name.outputs.image_name }} | ||
| name=${{ inputs.dockerhub-repo }}/${{ steps.name.outputs.image_name }},enable=${{ env.check_var != null }} | ||
| # generate Docker tags based on the following events/attributes | ||
| tags: | | ||
| type=raw,value=${{ inputs.image-version }} | ||
| # type=schedule | ||
| # type=ref,event=branch,enable=${{ env.is_default_R }} | ||
| # type=ref,event=branch,suffix=-R${{ inputs.r-version }} | ||
| # type=ref,event=pr | ||
| # type=semver,pattern={{version}},enable=${{ env.is_default_R }} | ||
| # type=semver,pattern={{major}}.{{minor}},enable=${{ env.is_default_R }} | ||
| # type=semver,pattern={{major}},enable=${{ env.is_default_R }} | ||
| # type=semver,pattern={{version}},suffix=-R${{ inputs.r-version }} | ||
|
|
||
| # setup docker build | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| id: buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Inspect Builder | ||
| run: | | ||
| echo "Name: ${{ steps.buildx.outputs.name }}" | ||
| echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
| echo "Status: ${{ steps.buildx.outputs.status }}" | ||
| echo "Flags: ${{ steps.buildx.outputs.flags }}" | ||
| echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
|
|
||
| # login to registries | ||
| - name: Login to DockerHub | ||
| env: | ||
| check_var: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| if: env.check_var != null | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
|
||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # build the docker images | ||
| - name: Build and push ${{ steps.name.outputs.image_name }} | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ${{ inputs.build-context }} | ||
| file: ${{ inputs.dockerfile }} | ||
| push: true | ||
| platforms: ${{ inputs.platforms }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| build-args: | | ||
| VERSION=${{ steps.meta.outputs.version }} | ||
| IMAGE_VERSION=${{ steps.meta.outputs.version }} | ||
| PECAN_VERSION=${{ steps.meta.outputs.version }} | ||
| R_VERSION=${{ inputs.r-version }} | ||
| ${{ steps.parent.outputs.PARENT_IMAGE_IF_SET }} | ||
| ${{ steps.modelver.outputs.MODEL_VERSION_IF_SET }} | ||
| GITHUB_PAT=${{ secrets.GITHUB_TOKEN }} | ||
| PECAN_GIT_BRANCH=${{ github.head_ref || github.ref_name }} | ||
| PECAN_GIT_CHECKSUM=${{ github.sha }} | ||
| PECAN_GIT_DATE=${{ github.event.repository.updated_at }} | ||
This file contains hidden or 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,73 @@ | ||
| name: Apptainer GHA CARB | ||
|
|
||
| env: | ||
| DEFAULT_R_VERSION: 4.4 | ||
| R_VERSION: 4.4 | ||
| GITHUB_PAT: ${{ secrets.GH_TOKEN }} | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
|
|
||
| pull_request: | ||
| merge_group: | ||
| workflow_dispatch: | ||
| inputs: | ||
| r_version: | ||
| description: 'R version to use' | ||
| required: true | ||
| type: choice | ||
| default: "$DEFAULT_R_VERSION" | ||
| options: | ||
| - 4.1 | ||
| - 4.2 | ||
| - 4.3 | ||
| - 4.4 | ||
| - devel | ||
| image_version: | ||
| description: 'version of sipnet container to use' | ||
| required: true | ||
| type: choice | ||
| default: "latest" | ||
| options: | ||
| - develop | ||
| - latest | ||
|
|
||
| jobs: | ||
| # ---------------------------------------------------------------------- | ||
| # Set R version. | ||
| # This is a hack: We really just want a global env var here, but it seems | ||
| # `env:` values can't be passed into a `jobs.<jobid>.with` context | ||
| # (see https://github.com/actions/runner/issues/2372). | ||
| # As an ugly workaround, we assign it to a job output instead. | ||
| # ---------------------------------------------------------------------- | ||
| rversion: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - id: default | ||
| if: github.event_name != 'schedule' | ||
| run: echo "R_VERSION=4.4" >> "$GITHUB_OUTPUT" | ||
| outputs: | ||
| # Note: "steps.*" seems to mean "all step ids", not "all steps" | ||
| # If seeing weird results here, check that all steps above have an id set. | ||
| R_VERSION: 4.4 | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Next are images that have specific layers added | ||
| # ---------------------------------------------------------------------- | ||
| sipnet-carb: | ||
| needs: [rversion] | ||
| uses: ./.github/workflows/apptainer-build-image.yml | ||
| with: | ||
| image-name: sipnet-carb | ||
| build-context: tools/apptainer-sipnet-carb | ||
| dockerfile: tools/apptainer-sipnet-carb/Dockerfile | ||
| r-version: ${{ needs.rversion.outputs.R_VERSION }} | ||
| parent-image: "pecan/model-sipnet-git" | ||
| image-version: ${{ inputs.image_version }} | ||
| secrets: | ||
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
|
This file contains hidden or 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,103 @@ | ||
| name: Run Workflow Examples | ||
|
|
||
| env: | ||
| GITHUB_PAT: ${{ secrets.GH_TOKEN }} | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| paths: | ||
| - 'workflow_examples/**' | ||
| - '.github/workflows/run-workflow-examples.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'workflow_examples/**' | ||
| - '.github/workflows/run-workflow-examples.yml' | ||
| workflow_dispatch: | ||
| inputs: | ||
| orchestration_version: | ||
| description: 'Orchestration XML version to use (devel or latest)' | ||
| required: true | ||
| type: choice | ||
| default: 'devel' | ||
| options: | ||
| - devel | ||
| - latest | ||
|
|
||
| jobs: | ||
| # ---------------------------------------------------------------------- | ||
| # Workflow 01: Data Prep Workflow | ||
| # This is the first workflow that prepares the base data | ||
| # ---------------------------------------------------------------------- | ||
| workflow_01_data_prep: | ||
| runs-on: ['self-hosted', 'Linux', 'X64'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set orchestration XML version | ||
| id: orchestration | ||
| run: | | ||
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
| echo "version=${{ github.event.inputs.orchestration_version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=devel" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run 01_data_prep_workflow | ||
| working-directory: workflow_examples/01_simple_data_workflow | ||
| run: | | ||
| Rscript 01_data_prep_workflow.R -s ../../.github/workflows_resources/01_orchestration_${{ steps.orchestration.outputs.version }}.xml | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Workflow 02: Data Reference Workflow | ||
| # This workflow references data from workflow 01 | ||
| # ---------------------------------------------------------------------- | ||
| workflow_02_data_reference: | ||
| needs: [workflow_01_data_prep] | ||
| runs-on: ['self-hosted', 'Linux', 'X64'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set orchestration XML version | ||
| id: orchestration | ||
| run: | | ||
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
| echo "version=${{ github.event.inputs.orchestration_version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=devel" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run 02_run_data_reference_workflow | ||
| working-directory: workflow_examples/02_referencing_data_workflow | ||
| run: | | ||
| Rscript 02_run_data_reference_workflow.R -s ../../.github/workflows_resources/02_orchestration_${{ steps.orchestration.outputs.version }}.xml | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Workflow 03: Distributed Workflow | ||
| # This workflow runs the distributed analysis workflow | ||
| # ---------------------------------------------------------------------- | ||
| workflow_03_distributed: | ||
| needs: [workflow_02_data_reference] | ||
| runs-on: ['self-hosted', 'Linux', 'X64'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set orchestration XML version | ||
| id: orchestration | ||
| run: | | ||
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
| echo "version=${{ github.event.inputs.orchestration_version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=devel" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run 03_run_distributed_workflow | ||
| working-directory: workflow_examples/03_distributed_workflow | ||
| run: | | ||
| Rscript 03_run_distributed_workflow.R -s ../../.github/workflows_resources/03_orchestration_${{ steps.orchestration.outputs.version }}.xml | ||
|
|
This file contains hidden or 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,19 @@ | ||
| <?xml version="1.0"?> | ||
| <pecan> | ||
| <orchestration> | ||
| <workflow.base.run.directory>/project/60007/hpriest/data/workflow_runs_ci</workflow.base.run.directory> | ||
| <functions.source>../../tools/workflow_functions.R</functions.source> | ||
| <distributed.compute.adapter> | ||
| <name>localhost</name> | ||
| <qsub>sbatch -J @NAME@ -o @STDOUT@ -e @STDERR@ apptainer run ./sipnet-carb_develop.sif </qsub> | ||
| <qsub.jobid>Submitted batch job ([0-9]+)</qsub.jobid> | ||
| <qstat>if test -z "$(squeue -h -j @JOBID@)"; then echo "DONE"; fi</qstat> | ||
| </distributed.compute.adapter> | ||
| <workflow.data.prep.1> | ||
| <run.identifier>data_prep_run_01</run.identifier> | ||
| <pecan.xml.path>./01_pecan_config_devel.xml</pecan.xml.path> | ||
| <ccmmf.data.s3.url>s3://carb/data/workflows/phase_1a</ccmmf.data.s3.url> | ||
| <ccmmf.data.tarball.filename>00_cccmmf_phase_1a_input_artifacts.tgz</ccmmf.data.tarball.filename> | ||
| </workflow.data.prep.1> | ||
| </orchestration> | ||
| </pecan> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is a lightly modified version of the
docker-build-image.ymlin PecanProject/pecan and I have a vague memory of seeing instructions for using workflow files from other repositories. Would it be worth investigating if we can call this from the PEcAn repo rather than maintain duplicate versions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its definitely worth investigating. In moving it into this repository, I hesitated to create a new maintenance point for the same method. Investigation is the right word - i have questions, such as: which ghcr/docker repo will the created sipnet-carb image end up in? (which do we want it to end up in?) Can we invoke the method in the pecan repo using secrets in the ccmmf repo?
I'll look into it.