From e4e6b6421540a205224cfe98fc78e94e85217c42 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:03:28 +0000 Subject: [PATCH] apps, playsicb --- README.md | 14 ++++--- apps_showcase/bin/gnome-message | 7 ++++ apps_showcase/flow.cylc | 43 ++++++++++++++++++++ apps_showcase/rose-suite.conf | 0 plausible/flow.cylc | 69 +++++++++++++++++++++++++++++++++ simplest/flow.cylc | 45 ++++----------------- 6 files changed, 136 insertions(+), 42 deletions(-) create mode 100755 apps_showcase/bin/gnome-message create mode 100644 apps_showcase/flow.cylc create mode 100644 apps_showcase/rose-suite.conf create mode 100644 plausible/flow.cylc diff --git a/README.md b/README.md index 5fd4e1b..d98c274 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,18 @@ You may find these easier to start with than writing a suite from scratch. ## Data Retrieve First -* Demo a very simple pattern where we ensure data has been collected - before analysing it. +Demo a very simple pattern where we ensure data has been collected +before analysing it. ## Five Day Collector -* Collect data for a period, then analyse it. +Collect data for a period, then analyse it. ## Meta Workflow -* Demonstrates how `cylc play -t` can allow you to store separate flows in - one workflow. \ No newline at end of file +Demonstrates how `cylc play -t` can allow you to store separate flows in +one workflow. + +## Optional Outputs + +Designed to show how optional outputs could support a workflow making choices. diff --git a/apps_showcase/bin/gnome-message b/apps_showcase/bin/gnome-message new file mode 100755 index 0000000..1aeb314 --- /dev/null +++ b/apps_showcase/bin/gnome-message @@ -0,0 +1,7 @@ +#!/bin/bash + +export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=/run/user/${UID}/bus}" +notify-send "Cylc Workflow ${1}" \ +"${CYLC_WORKFLOW_ID}, ${1}. \nMessage Sent by event handler." \ + --icon face-sad \ + --app-name "Cylc - Workflow Stalled" diff --git a/apps_showcase/flow.cylc b/apps_showcase/flow.cylc new file mode 100644 index 0000000..7dff4c9 --- /dev/null +++ b/apps_showcase/flow.cylc @@ -0,0 +1,43 @@ +[meta] + description = """ + Showcase of interesting apps. + """ + +[scheduler] + [[events]] + stall handlers = gnome-message stall + +[scheduling] + [[graph]] + R1 = """ + gnome_message + """ + +[runtime] + [[gnome_message]] + script = """ + export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=/run/user/${UID}/bus}" + notify-send "Hello World" \ + "Here's any old message." \ + --icon face-smile \ + --app-name "Cylc Notify Demo" + + exit 1 + """ + err-script = """ + export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=/run/user/${UID}/bus}" + notify-send "Cylc Task Failed" \ + "${CYLC_WORKFLOW_ID}//${CYLC_TASK_ID}\nMessage sent by error script." \ + --icon face-sad \ + --app-name "Cylc Notify Demo" + """ + [[[meta]]] + description = """ + Send a message to Gnome. + + Probably only works on --host=localhost. + + Hint - list of icons... + + find /usr/share/icons/* -name "*.png" + """ diff --git a/apps_showcase/rose-suite.conf b/apps_showcase/rose-suite.conf new file mode 100644 index 0000000..e69de29 diff --git a/plausible/flow.cylc b/plausible/flow.cylc new file mode 100644 index 0000000..6eb08d8 --- /dev/null +++ b/plausible/flow.cylc @@ -0,0 +1,69 @@ +#!jinja2 +[meta] + description = This is a workflow created by a script.. + created on = 2024-11-11T13:7 + +[task parameters] + assimilation_job = 1..12 + forecast_job = 1..12 + pp_job = 1..6 + +[scheduler] + allow implicit tasks = True + cycle point format = %Y + +[scheduling] + initial cycle point = 1971 + [[graph]] + R1 = install_cold & get_archive_data => start_cycle + P1Y = """ + FORECAST[-P1Y]:succeed-all => start_cycle => + ASSIMILATION:succeed-all => _skip2 => FORECAST + """ + P5Y = """ + FORECAST[-P4Y]:succeed-all => skip3 + FORECAST[-P3Y]:succeed-all => skip3 + FORECAST[-P2Y]:succeed-all => skip3 + FORECAST[-P1Y]:succeed-all => skip3 + FORECAST:succeed-all => skip3 + skip3 => POSTPROC:finish-all => archive => mousekeep + """ + + +[runtime] + [[root]] + script = """ + echo "Hello World!" + max=$(((RANDOM % 20) + 1)) + sleepy=$(((max + 10) - (RANDOM % max))) + printf "This script will sleep for %d\n" "$sleepy" + cylc message -- "INFO:Sleep $sleepy" + sleep "$sleepy" + echo "The script has finished sleeping" + """ + [[HOUSEKEEPING]] + [[BIG_SLURMJOB]] + [[WEE_SLURMJOB]] + [[ASSIMILATION]] + [[FORECAST]] + [[POSTPROC]] + [[FLOWCONTROL]] + + [[install_cold, get_archive_data, mousekeep, archive]] + inherit = HOUSEKEEPING, WEE_SLURMJOB + + [[assimilation]] + inherit = ASSIMILATION, WEE_SLURMJOB + + [[forecast]] + inherit = FORECAST, BIG_SLURMJOB + + [[pp]] + inherit = POSTPROC + + [[mousekeep]] + inherit = HOUSEKEEPING + + [[start_cycle, skip3, _skip2]] + inherit = FLOWCONTROL + script = true diff --git a/simplest/flow.cylc b/simplest/flow.cylc index b938fb3..f1cc4da 100644 --- a/simplest/flow.cylc +++ b/simplest/flow.cylc @@ -1,21 +1,8 @@ -#!jinja2 - -{% from 'cylc.flow' import LOG %} -{% do LOG.info('Tim\'s Simplest Workflow\n -----------------------') %} -{% do LOG.warn('This workflow runs for about an hour and cycles somewhat rapidly - it may stress the host.') %} - [meta] title = "Simplest Workfløw" description = """ Should give you just enough to get going - - ## CLI args - - * `-S 'CYCLE=""'` allows you to set the cycling. - default is "PT1H" """ - written for cylc version = 7.x - test with cylc version = 7.8.11 [scheduler] UTC mode = True @@ -24,30 +11,14 @@ # initial cycle point is NOT optional initial cycle point = 19831213T0600Z - # final cycle point is entirely optional -<<<<<<< HEAD - # Default value makes the workflow run for about 1 hour: - final cycle point = 19840412T1200Z -======= - final cycle point = 19831214T0600Z ->>>>>>> ac30974 (fi) - [[graph]] - {{ CYCLE|default("PT1H", true) }} = Quokka => Numbat => Wambenger - + R1 = cold_start + P1D = task [runtime] - [[MARSUPIALS]] - script= sleep {{ SLEEP | default(3, true) }} - - [[Quokka]] - inherit=MARSUPIALS - script = sleep 15 - - [[Numbat]] - inherit=MARSUPIALS - - [[Wambenger]] - inherit=MARSUPIALS - - + [[cold_start]] + script = """ + """ + [[task]] + script = """ + """