From 9eb8a4bc611c6bb7603d65db4c55da568a93d37c Mon Sep 17 00:00:00 2001 From: James Gilbert Date: Mon, 2 Feb 2026 10:53:51 +0000 Subject: [PATCH] feat(examples): add DAWN powder calibration workflow template --- .../dawn-powder-calibration.yaml | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 examples/conventional-templates/dawn-powder-calibration.yaml diff --git a/examples/conventional-templates/dawn-powder-calibration.yaml b/examples/conventional-templates/dawn-powder-calibration.yaml new file mode 100644 index 000000000..81a3b4b6e --- /dev/null +++ b/examples/conventional-templates/dawn-powder-calibration.yaml @@ -0,0 +1,163 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ClusterWorkflowTemplate +metadata: + name: dawn-powder-calibration + labels: + workflows.diamond.ac.uk/science-group-examples: "true" + annotations: + workflows.argoproj.io/title: DAWN Powder calibration + workflows.argoproj.io/description: | + Runs the DAWN command-line powder calibration tool from a given config JSON file. All file paths used + in the config must be in the same directory as the config file (or within a sub-directory). + (https://diamondlightsource.atlassian.net/wiki/spaces/DT/pages/1378465/Command-Line+Powder+Calibration) + + workflows.diamond.ac.uk/parameter-schema.confpath : | + { + "type": "string", + "minLength": 1, + "default": "/path/to/config.json" + } + workflows.diamond.ac.uk/parameter-schema.fixparam : | + { + "type": "string", + "oneOf": [ + { + "const": "", + "title": "Nothing fixed" + }, + { + "const": "-fixedWavelength", + "title": "Fixed wavelength" + }, + { + "const": "-fixedDistance", + "title": "Fixed distance" + } + ], + "default": "" + } + workflows.diamond.ac.uk/parameter-schema.fixvalue: | + { + "type": "number", + "minimum": 0, + } + workflows.diamond.ac.uk/ui-schema: | + { + "type": "VerticalLayout", + "elements": [ + { + "type": "Control", + "label": "Path to the config JSON file", + "scope": "#/properties/confpath" + }, + { + "type": "Control", + "label": "Fix wavelength or distance?", + "scope": "#/properties/fixparam" + }, + { + "type": "Control", + "label": "Wavelength (Angstrom)", + "scope": "#/properties/fixvalue", + "rule": { + "effect": "SHOW", + "condition": { + "scope": "#/properties/fixparam", + "schema": { "const": "-fixedWavelength"} + } + } + }, + { + "type": "Control", + "label": "Distance (mm)", + "scope": "#/properties/fixvalue", + "rule": { + "effect": "SHOW", + "condition": { + "scope": "#/properties/fixparam", + "schema": { "const": "-fixedDistance"} + } + } + } + ] + } +spec: + entrypoint: calibration-entry + arguments: + parameters: + - name: confpath + value: "" + - name: fixparam + value: "" + - name: fixvalue + value: 0 + + templates: + - name: calibration-entry + dag: + tasks: + - name: parse-config-path + template: parse-config-path + + - name: run-calibration + dependencies: [parse-config-path] + template: run-calibration + arguments: + parameters: + - name: mount-dir-path + value: "{{tasks.parse-config-path.outputs.result}}" + + - name: run-calibration + inputs: + parameters: + - name: mount-dir-path + script: + env: + - name: JAVA_TOOL_OPTIONS + value: "-Duser.name=dawn -Duser.home=/tmp/" + image: ghcr.io/dawnscience/dawn:latest + volumeMounts: + - name: config-dir + mountPath: "{{ inputs.parameters.mount-dir-path }}" + - name: tmp-dir + mountPath: /tmp + workingDir: /tmp-dir + command: [/bin/bash] + source: | + fixflag="" + if [ {{ workflow.parameters.fixparam }} != "" ]; then + fixflag="{{ workflow.parameters.fixparam }} {{ workflow.parameters.fixvalue}}" + fi + /dawn_workspace/dawn $fixflag -configuration /tmp -consoleLog -noSplash -data @none \ + -application uk.ac.diamond.scisoft.diffraction.powder.application.powdercalibrate \ + -path {{ workflow.parameters.confpath }} + + podSpecPatch: | + containers: + - name: main + resources: + requests: + memory: 4Gi + limits: + memory: 4Gi + volumes: + - name: config-dir + hostPath: + path: "{{ inputs.parameters.mount-dir-path }}" + type: Directory + - name: tmp-dir + emptyDir: {} + + outputs: + artifacts: + - name: dawn-logs + path: /tmp/dawn-dawn.log + archive: + none: {} + + - name: parse-config-path + script: + image: busybox + command: [/bin/sh, "-c"] + args: + - echo {{ workflow.parameters.confpath }} | sed 's![^/]*$!!'