-
Notifications
You must be signed in to change notification settings - Fork 7
Updated workflow templating #656
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
Draft
mranst
wants to merge
247
commits into
develop
Choose a base branch
from
se/mranst/workflow_templating_redux2
base: develop
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.
Draft
Changes from 198 commits
Commits
Show all changes
247 commits
Select commit
Hold shift + click to select a range
933b142
Initial commit
mranst d46b22f
adding workflow string
mranst e1c3816
working
mranst e3e7d74
fixing section formatting
mranst 3788c9c
redo task questions
mranst f661549
update task questions
mranst 4d94820
update task questions again
mranst 6e5fa8d
mostly working
mranst b69e974
Functional, fixing indentation
mranst 71370dd
pycodestyle fixes
mranst d0d6a1c
Fix slurm formatting in runtime
mranst 65d97a3
Simplify task runtime definitions
mranst c1bb1fc
remove print statement
mranst 0ec6316
Fix slurm setting
mranst d584c5d
Remove duplicate import
mranst 21828f4
Remove setter methods
mranst d00d382
Simplify formatting
mranst b699e87
Simplify workflows and suite configs
mranst 5be480c
Clean up and introduce question order test
mranst 7a88864
Initial commit
mranst d051a2d
Merge branch 'se/mranst/cylc_templating' into feature/mranst/workflow…
mranst 78303bd
remove non-task tasks from tasks
mranst c3edeea
Merge branch 'se/mranst/cylc_templating' into feature/mranst/workflow…
mranst 540e088
add test for jedi
mranst f9b5cd5
add compare command for jedi
mranst 9c307f0
Add workflow pause and event status emails
mranst 375b40f
Add message on pause and fix to messaging
mranst b38e0ac
pycodestyle fix
mranst eb83c5b
Update slurm code test
mranst f92d4c6
added some suites
mranst 86c580f
add workflows
mranst 776e2d8
add all suite workflows
mranst 1743046
fix cycle times
mranst 175210f
add all suites
mranst b8ea4ca
fixes
mranst 991b9f0
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst 336a2c9
add cycling_varbc
mranst bb5984d
remove print statement
mranst 904ffff
revise templating
mranst 07111f2
revise templating for all suites
mranst 70e5e4b
fixes for code tests
mranst 53498ef
try to fix unused variables
mranst 56862f3
functional code tests
mranst 54ecaef
pycodestyle fixes
mranst f1c2fd2
Merge branch 'tmp' into feature/mranst/workflows_for_comparison
mranst 24396f3
revise templating for 3dfgat_cycle
mranst 14ca733
fix task_runtimes
mranst f1dd07b
fix cycling
mranst ab1fa20
fix for forecast_geos
mranst ab20791
fixes to suites
mranst ddb8f56
add comments
mranst e09e98e
test plots
mranst 337110c
add imcrement comparison
mranst 7e5d223
Functional comparison plots
mranst 43e35f1
Add comments for comparison plots
mranst 8164a42
pycodestyle fixes
mranst b8029e2
fix workflow
mranst 7060a77
check for fgrep status
mranst cb29859
use cylc cycling
mranst 3456872
rework fgrep task
mranst a15ce9a
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst 7eec497
Fix for missing cycle times
mranst 4de85f1
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst e2b3bca
Fix for localensembleda
mranst a2e4d40
Use datetime interval
mranst 9217190
fixes for localensembleda
mranst ce104cb
Merge branch 'feature/mranst/workflows_for_comparison' of discover.nc…
mranst 5f39fd1
Clean up eva comparison plots
mranst c1f8ddb
Add Jedi-log comparison plots
mranst 19f6078
fixes for jedi_log
mranst 8e74f79
add legend
mranst 8071451
Link akbk*.nc4 to the fv3files/ directory (#602)
metdyn 62878d9
SWELL now controls on peripheral files (#603)
rtodling f478178
Add task to get observations from GEOS location (#577)
mranst 293ef9f
Automatically set window length for cycling (#604)
mranst 176fda9
Fix for localensembleda
mranst 2c8bd5c
Use datetime interval
mranst 9a65fb4
fixes for localensembleda
mranst 2272a65
Clean up eva comparison plots
mranst 6958435
Add Jedi-log comparison plots
mranst 2eb77e7
fixes for jedi_log
mranst 0ff8e73
add legend
mranst 59c96e3
Add jedi log parser for atmos
mranst 82f1b82
Merge branch 'feature/mranst/workflows_for_comparison' of discover.nc…
mranst edab5f6
add increment for atmos
mranst e89cee4
fix
mranst ab12f72
fix transform
mranst 41f5277
Fix layout
mranst ff5960d
add examples
mranst 9521c2e
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst 04a5c37
remove flow.cylc
mranst 3a15b8f
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst d1888ec
add example to docs
mranst 66e1f6c
add eva_capabilities workflow
mranst 607bddb
correct eva_capabilities workflow
mranst 3f7337c
fix sstagejedicycle
mranst ceff12d
replace defer_to_platform
mranst 6ac3415
test fixes
mranst 66f7597
simplify comparison suite
mranst d7e7ce9
add tier test output
mranst d9c718e
clean up tier test output
mranst 94520dd
write to file
mranst fd1ac21
add new documentation
mranst 8040b97
Add diff and tolerances for residual norms
mranst c4d17cc
clean up
mranst ac7551e
Add docs for csh interactive install (#631)
mranst 35d98ab
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst de3ed0d
test fixes
mranst 14ef1a7
Merge branch 'develop' into feature/mranst/workflows_for_comparison
mranst eee3ff7
add log comparison
mranst 8a307bc
revise number of iterations
mranst b76b1b2
add window_length
mranst a08c1fe
simplify 3dvar:
mranst 26a51a1
fixes
mranst 7685720
runtime
mranst 2b31496
fixes
mranst fa6827c
add flow.cylc
mranst 0ba365e
add cycle_times
mranst 76ead50
fix cycle_times
mranst f29416b
revert workflows
mranst e9f8fcf
create experiment
mranst 2b5d385
fix 3dfgat_cycle
mranst b1ea5e1
code test fixes
mranst 0745061
Merge branch 'develop' into feature/mranst/workflows_for_comparison_r…
mranst 36af1d5
fix cycles
mranst c12d2cc
fix cycle_times
mranst 9baf275
refactor 3dvar
mranst a10fe65
fixes
mranst ca80be7
updates
mranst a345f53
rework
mranst 64f6d07
migrate all files
mranst 3e74019
fix task runtime section
mranst f3da5e3
Refactor into task_attributes class
mranst ad01ab6
fixes for all suites
mranst c4ba559
change names of task_spec
mranst ee07db0
clean up
mranst a902260
refactor self.tasks
mranst cac1b7b
code style fix
mranst de089eb
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 90ea975
fixes to flow
mranst bdb5fda
Add docs for new method
mranst 0b6a231
Add create_task_config
mranst 043d34e
fixes
mranst 5de27b6
code test fixes
mranst f7165e9
Add cwd flag
mranst eac5c03
Fixes
mranst 9a4bd06
fix input_method
mranst b0e63e4
Fixes for questions
mranst 6432737
Fix cycle times
mranst f308408
Fix for comparison suites
mranst 1ea1be3
add time limit to slurm directives
mranst 555e810
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 26b6fa1
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 33f911f
address comments
mranst ca92d9f
pycodestyle fix
mranst 038ddb9
Fix default_value
mranst 7ddae1c
Remove task questions
mranst bf1eaf2
Rework settings files
mranst 2b8f8ff
Refactor location of task attributes
mranst 7332d63
Rename task_setup
mranst ec17774
Fix
mranst 9c8dc2b
Address comments
mranst 1f897cf
code style fixes
mranst a136729
Add comments and refactoring changes
mranst db60a4b
Fixes for refactoring
mranst 6399bca
Add docstrings
mranst a304a1d
pycodestyle fix
mranst 256fd33
Add docstrings
mranst 4872c61
pycodestyle fix
mranst 8dd603c
comparison test fixes
mranst 862b1b7
refactor questions
mranst e9304bb
Update docs
mranst 57730a2
Refactor email address
mranst f4f677c
Don't use unset email address
mranst dc92d3b
Update docs/examples/templating_workflows.md
mranst 6351224
Update slurm settings
mranst f192652
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 10b55bc
pycodestyle fix
mranst 46143e3
working
mranst a6cacfa
Refactor
mranst 5fa08bf
Refactor
mranst 7ec1c51
syntax fix
mranst 688cfd9
fixes for flow.cylc
mranst 020838d
discover
mranst c48a32e
try registry
mranst 77d5b1f
fixes
mranst c7477c9
register all tasks
mranst 8d34b15
fix stage_jedi_cycle
mranst c0839a7
add registry to all tasks
mranst c334659
Add docs
mranst 3bb0b6d
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst d329a39
Move jedi_bundle import
mranst 47462f5
fix import
mranst 2fc2e18
Move build imports
mranst a9007b2
code test fix
mranst 8cb8012
Code test fix
mranst 901bb5a
fix for jedi_bundle
mranst c20689b
Increase time limit for build_jedi
mranst 691444b
cast to list
mranst 275647b
Fix override bug and use ruamel
mranst f4a27c7
Type hint fixes
mranst 613e31d
Add docstrings
mranst 9ebf6fd
Remove flow.cylc
mranst f745458
Add type annotations and remove registry
mranst cb3753c
add comments for local imports
mranst 537afb6
Update adding a suite docs
mranst 2b15bd4
Resolve override dictionary
mranst 0a92f44
Code test fixes
mranst 3d15d48
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 90ded9a
Code test fixes
mranst 8476c87
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst a6fd35a
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst cdddd54
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst d094ac1
Fix for ensemble
mranst dabe9b2
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst d72b275
Refactor names of time_limit and is_model
mranst 6af195b
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst a232474
Code test fixes
mranst d490b7c
pycodestyle
mranst 1071286
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst fd52380
Refactor question_defaults to configuration
mranst fad4afa
add configuration question defaults
mranst 5f7c031
move discover_plugins
mranst 7cde879
Refactor task defaults to allow suite override
mranst ade5600
Update docs for new locations
mranst dcd9caf
add docstrings
mranst f11c84e
Switch suite config method
mranst 4c31865
Refactor suite configs
mranst 66ef0d0
Refactor 3dvar
mranst 2d1cf08
Refactor suite configs
mranst 13674b6
Refactor suite configs to be more straightforward
mranst 06e4c86
Add files for merge with develop
mranst 8e1b8f3
Register workflows
mranst 90c3063
Fix convert_ncdiags
mranst 02c5885
Update docs
mranst 583f6aa
Fix code tests
mranst 36903ef
Refactor question defaults
mranst 6ca1791
Update docs for question defaults
mranst 898ed8e
Refactor suite_attributes.py
mranst 13411e2
code test fixes
mranst f2a8d16
Remove unused list_name
mranst aa468bb
Remove get_suites
mranst 433ba0d
refactor suite attributes
mranst 904e679
Fix task minimum
mranst 2014fd1
Use subprocess and check exit status for mksi
mranst 9123319
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst c01685a
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 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,109 @@ | ||
| # Templating cylc workflows within swell | ||
| The `flow.cylc` file informs the `Cylc` workflow engine on how to run an experiment. This includes the order in which tasks should be run, and the scripts and environment variables necessary for each task. Templating a workflow within Swell previously used `jinja2` templating on a file named `flow.cylc` under each suite. This has been replaced with an approach that uses a python class to manipulate strings to generated the `flow.cylc` used in the experiment. This allows for more complex logic to be performed in generating the workflow, but also may be confusing to users. This documentation serves to explain the new method of templating workflows under these changes. | ||
|
|
||
| ## Cylc sections | ||
|
|
||
| The `flow.cylc` that is generated under this method is not much different from the one generated before, and users shouldn't notice a difference when it comes to creating an experiment, using overrides, etc. When creating an experiment, `swell` consults a file `src/swell/suites/<suite>/workflow.py` on how to construct the suite. This file should be an extension of the `CylcWorkflow` class (defined in `src/swell/utilities/cylc_workflow.py`). The method `get_workflow_string` is called to return a string which fills the contents of the `flow.cylc` file. Overriding this method is used to manually specify the contents of the file. Typically, the graph section is templated in `jinja2`, and the runtime sections for each task are generated using swell's `TaskAttribute` class. However, the entire `flow.cylc` file can be templated in `jinja`, if necessary. | ||
|
|
||
|
|
||
| ## Tasks and the runtime section | ||
|
|
||
| Swell will parse the graph section, which is constructed first, to obtain the tasks which are used by the experiment. It will then build the runtime section by consulting task setup objects. Since swell tasks broadly fall into only a few categories (model-dependent or independent, cycling or non-cycling) that do not differ much between suites, they are easily abstracted into a `TaskSetup` class. This class will dynamically set attributes such as messaging parameters and slurm settings. Each task has an associated `TaskSetup` class, which is defined in the main task file, and registered into the `TaskAttributes` container. For example, the following displays the `TaskSetup` class for `CloneJedi`, located in `src/swell/tasks/clone_jedi.py`: | ||
|
|
||
| ```python | ||
|
|
||
| task_name = 'CloneJedi' | ||
|
|
||
|
|
||
| @task_attributes.register(task_name) | ||
| class Setup(TaskSetup): | ||
| def set_attributes(self): | ||
| self.base_name = task_name | ||
| self.questions = [ | ||
| qd.bundles(), | ||
| qd.existing_jedi_source_directory(), | ||
| qd.existing_jedi_source_directory_pinned(), | ||
| qd.jedi_build_method() | ||
| ] | ||
| ``` | ||
|
|
||
| Other tasks have different requirements, such as `EvaObservations`: | ||
|
|
||
| ```python | ||
| task_name = 'EvaObservations' | ||
|
|
||
|
|
||
| @task_attributes.register(task_name) | ||
| class Setup(TaskSetup): | ||
| def set_attributes(self): | ||
| self.base_name = task_name | ||
| self.time_limit = True | ||
| self.is_cycling = True | ||
| self.is_model = True | ||
| self.slurm = {} | ||
| self.questions = [ | ||
| qd.background_time_offset(), | ||
| qd.crtm_coeff_dir(), | ||
| qd.observations(), | ||
| qd.observing_system_records_path(), | ||
| qd.marine_models(), | ||
| qd.observing_system_records_path(), | ||
| qd.window_length(), | ||
| qd.marine_models(), | ||
| ] | ||
| ``` | ||
|
|
||
| Attributes are set by override the `set_attributes` method in `TaskSetup`. This has been combined with the previously-used `task_questions.py` for simplicity. | ||
|
|
||
| The tags `is_cycling` and `is_model` (both `False` by default) modify the script command (`swell task <task name> $config`): | ||
|
|
||
| - `is_cycling = True` adds `-d $datetime` for cycling tasks | ||
| - `is_model = True` adds `-m {model}` to indicate model-specific tasks. | ||
|
|
||
| The `slurm` attribute determines where or not the task requires Slurm and provides a way to set task-specific overrides: | ||
|
|
||
| - `slurm = None` means the task is not a Slurm task, so no `[[[directives]]]` section will be written. | ||
| - `slurm = {}` means the task *is* a Slurm task, so the `[[[directives]]]` will be populated according to the platform's default slurm settings (in `src/swell/deployment/platforms`) along with user-specific overrides. | ||
| - `slurm = {<arguments>}` will optionally override the platform defaults with task-specific ones (but note that *user-configured overrides always have the highest priority*). | ||
|
|
||
| For the task specification above for `EvaObservations`, the runtime section will be renderend as the following: | ||
|
|
||
| ``` | ||
| [[EvaObservations-geos_marine]] | ||
| script = "swell task EvaObservations $config -d $datetime -m geos_marine" | ||
| platform = nccs_discover_sles15 | ||
| execution time limit = PT30M | ||
| [[[directives]]] | ||
| --job-name = EvaObservations-geos_marine | ||
| --qos = allnccs | ||
| --nodes = 1 | ||
| --ntasks-per-node = 64 | ||
| --constraint = mil | ||
| --no-requeue = | ||
| --account = <account> | ||
| ``` | ||
|
|
||
| This can be used to set task-specific defaults in `task_attributes.py`, rather than being set in `slurm.py`. For example, the task below defaults to slurm setting `--nodes=1`. | ||
|
|
||
| ```python | ||
| class RunJediConvertStateSoca2ciceExecutable(TaskSetup): | ||
| def set_attributes(self): | ||
| self.is_cycling = True | ||
| self.is_model = True | ||
| self.time_limit = True | ||
| self.slurm = {'nodes': 1} | ||
| ``` | ||
|
|
||
| This supports setting platform-specific overrides, for example: | ||
|
|
||
| ```python | ||
| class RunJediConvertStateSoca2ciceExecutable(TaskSetup): | ||
| def set_attributes(self): | ||
| self.is_cycling = True | ||
| self.is_model = True | ||
| self.time_limit = True | ||
| self.slurm = {'all': 1, | ||
| 'nccs_discover_cascade': 2} | ||
| ``` | ||
|
|
||
| On the `nccs_discover_cascade` platform, `nodes` will be set as 2, but on any other platform it will be 1. User overrides will still work as they did previously. | ||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.