-
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
318
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 all commits
Commits
Show all changes
318 commits
Select commit
Hold shift + click to select a range
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 4f48070
Add experiment ID for R2D2
mranst d32c3b9
Change location that registry happens in
mranst 28be5ba
add key for experiment lifetime
mranst 3d571cf
pycodestyle
mranst 1e65b35
Refactor
mranst f69dbe5
Load r2d2 modules during experiment creation (#701).
ftgoktas 7041a44
few touches
mranst 07714ea
fix mistake
mranst 07add94
Hard-code debug
mranst d3abcca
Add option to skip R2D2
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 b742b84
Merge branch 'develop' into feature/mranst/skip_r2d2
mranst 08e8674
Fixes
mranst e42e3b9
remove comma
mranst a97c229
code_test fix
mranst 51cecfe
Merge branch 'develop' into feature/mranst/skip_r2d2
metdyn 5f332cd
fix templating
mranst 2a5a0f8
Clean cycle after move da restart
mranst 987bbaf
Fixes to workflows
mranst 9119709
Add suite creation test
mranst 4b1a98c
Add to code tests
mranst eb58146
Add jedi config comparison tests
mranst 912b3f0
Change name of runTest
mranst 7430617
Merge branch 'feature/mranst/code_tests' of discover.nccs.nasa.gov:/h…
mranst 9c342ca
Separate into utility
mranst 13247a2
Add 3dvar_cf
mranst a0a9d28
Fix update_dict
mranst 4ccbc63
Merge branch 'feature/mranst/skip_r2d2' into feature/mranst/code_tests
mranst 05f8a7d
Add option to mock cycle dir
mranst 1ff3b24
Fix dictionary
mranst d5602da
Working
mranst 8cc96f8
Refactor and add to other suites
mranst df0d9df
add test
mranst 3e9a44f
staging
mranst 3d9a7f2
Add to utility scripts
mranst b25a6dd
Functional
mranst 7a20636
Add script
mranst cc4cd94
Merge branch 'develop' into feature/mranst/code_tests
mranst e6a8e05
add to package data
mranst 9edbcff
Add xarray to requirements
mranst 96e9e20
Merge branch 'develop' into feature/mranst/code_tests
mranst 5b7bed3
Update mock configs
mranst 6ffd59b
Remove print statement
mranst 63dac86
Move override file read
mranst 9a5b995
PR review
mranst 93390ac
Update test cache location
mranst 8cd261e
Merge branch 'develop' into feature/mranst/code_tests
mranst b9e77f8
code test fix
mranst 2a26f91
Merge branch 'develop' into feature/mranst/code_tests
mranst 2f098a0
Update 3dvar_cf config
mranst ff23a32
Add saber to other models
mranst 83c9b4c
Code test fixes
mranst 9d4a42a
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst 156fb28
Fix suite configs
mranst 1353409
Fix workflows
mranst 4a8219c
Fix flows
mranst 4d2b1ab
Merge branch 'se/mranst/workflow_templating_redux2' of discover.nccs.…
mranst f85cdab
Fixes
mranst 5da504d
Remove 3dvar_cycle
mranst fa620b7
Fix workflow names
mranst 6b0a48e
More fixes
mranst ac8d010
variational fixes
mranst 4ba400f
cf static files
mranst 3d048df
add 3dvar_cf workflow
mranst c2f111e
Fix stage_jedi
mranst 5833f55
Fix implicit tasks
mranst fca7d8a
Add comparisons for 3dvar_cf (#750)
mranst 36f9854
Code test fixes
mranst 8c1620f
Merge branch 'develop' into se/mranst/workflow_templating_redux2
mranst dd017a6
move requests import
mranst cf0c875
Code test fixes
mranst 644bc6e
Fix templating
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| 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/suites/base/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 `TaskSetup` 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.task_time_limit = True | ||
| self.is_cycling = True | ||
| self.model_dep = 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 `model_dep` (both `False` by default) modify the script command (`swell task <task name> $config`): | ||
|
|
||
| - `is_cycling = True` adds `-d $datetime` for cycling tasks | ||
| - `model_dep = 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.model_dep = True | ||
| self.task_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.model_dep = True | ||
| self.task_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
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.