Skip to content
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

Sprint/workflow_manager #1041

Draft
wants to merge 84 commits into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
80d3b6a
Added some temporary comments in workflow.py.
nwieters Sep 4, 2023
b63e9a9
Started to add docstrings to workflow.py
nwieters Sep 6, 2023
f9c0659
Added a docstring to esm_plugin_mamager
nwieters Sep 7, 2023
0c4a962
Some docstring changes in workflow.py
nwieters Sep 7, 2023
0452d3b
Started to improve the workflow documentation.
nwieters Sep 21, 2023
63e9cd5
Updating the workflow documentation.
nwieters Sep 27, 2023
14e4b65
Added a new general glossary.
nwieters Sep 27, 2023
f0bd385
Added comments to esm_plugin_manager
nwieters Oct 6, 2023
8c4b753
Start to refactor workflow.
nwieters Oct 6, 2023
a4a6b34
Update workflow documentation.
nwieters Oct 6, 2023
e329e14
Started to refactor workflow.py
nwieters Oct 6, 2023
d7f4565
Placed the default definition of workflow phases in esm_software.../d…
nwieters Oct 16, 2023
34456cb
Continued to improve documentationfor workflow manager.
nwieters Oct 17, 2023
b022c5d
Add language en in sphinxs conf.py
nwieters Oct 17, 2023
a2fc1a4
Update src/esm_plugin_manager/esm_plugin_manager.py
nwieters Oct 17, 2023
fef151d
Update src/esm_plugin_manager/esm_plugin_manager.py
nwieters Oct 17, 2023
c733a00
Update src/esm_runscripts/workflow.py
nwieters Oct 17, 2023
506c0a7
Correcte syntax of docstrings.
nwieters Oct 17, 2023
03b6e24
Renamed default_workflow_phases entry in defaults.yaml
nwieters Oct 17, 2023
b3b5fb1
Renamed workflow method, added property decorator and added test.
nwieters Oct 18, 2023
6260278
Added a temporary workflow to awicm3.
nwieters Oct 18, 2023
de0e598
Added method to return a list of an attribute for all phases.
nwieters Oct 20, 2023
11fa96b
Convert functions into methods, moved class variables to be instance …
nwieters Oct 23, 2023
b8d1db0
Further developments until order_cluster.
nwieters Oct 27, 2023
2cd0da6
Further changes for workflow manager.
nwieters Nov 3, 2023
98f4a7f
Merge branch 'release' into sprint/workflow_manager
nwieters Nov 9, 2023
273175f
Added prepend_newrun, skip_cluster, fixed next_submit entries.
nwieters Nov 10, 2023
3c72864
Reactivated function display_nicely.
nwieters Nov 13, 2023
47648ef
Added -i option to esm_runscripts usage
nwieters Nov 13, 2023
a0ae28a
Update documentation on how to inpect workflow.
nwieters Nov 14, 2023
547edb0
Added some flake8 style optimization.
nwieters Nov 14, 2023
6ab3f12
Update workflow examples.
nwieters Nov 16, 2023
43c40ca
Merge branch 'release' into sprint/workflow_manager_documentation
nwieters Nov 16, 2023
869cc0a
Adding another example for adding user phases to workflow.
nwieters Nov 16, 2023
465d8d3
Adapted the output for inspect (-i) workflow.
nwieters Nov 16, 2023
6aee395
Fix multiple phases in one cluster, fix batch_or_shell to be set by e…
nwieters Nov 16, 2023
138b3c2
Added some further comments and added cluster info in display_workflo…
nwieters Nov 17, 2023
92ea168
Added section defaults of new workflow phases.
nwieters Nov 17, 2023
fcf5a41
Add new workflow attribute in defaults.yaml.
nwieters Nov 17, 2023
5a3bfb8
Reactivated function complete_clusters.
nwieters Nov 17, 2023
e6bada5
Some changes for processing phases in awicm3.
nwieters Nov 17, 2023
ccafa8b
Update src/esm_runscripts/inspect.py
nwieters Nov 20, 2023
e107d99
Merged default and user phase class, made phase a subclass of dict.
nwieters Nov 20, 2023
ba204e6
Fixed some of the workflow tests.
nwieters Nov 20, 2023
6174fa3
Added review suggestions.
nwieters Nov 20, 2023
93b49b5
Changed initialization of workflow and phases.
nwieters Nov 22, 2023
afab16f
Changed initial config of default workflow phases.
nwieters Nov 22, 2023
ad0e620
Bugfix in error message.
nwieters Nov 22, 2023
91f1af6
Make next_run_triggered_by a keyword of phase (trigger_next_run) not …
nwieters Nov 22, 2023
aed2376
Bugfix if no phase trigger_next_run.
nwieters Nov 22, 2023
40c9190
Resolved function complete_cluster into other functions, fix next_sub…
nwieters Nov 23, 2023
1a8d121
Removed obsolete functions.
nwieters Nov 23, 2023
916a345
(Re)moved redundant code, renamed function for collecting phases.
nwieters Nov 24, 2023
c264f1a
Removed the possibility to set workflow keywords by user.
nwieters Nov 24, 2023
7395a9b
Changed next_run_triggered_by into phase keyworkd.
nwieters Nov 24, 2023
cf9d0e3
Worked on workflow tests, and other minor changes to workflow.
nwieters Nov 27, 2023
f86202d
Fixed a bug in order_phases_and_clusters
nwieters Nov 28, 2023
59590ed
Added workflow tests for test examples (in documentation).
nwieters Nov 28, 2023
ff7145b
Fixed test example_2, add preprocessing phase with adding newrun.
nwieters Nov 29, 2023
c784380
Added test for workflow example 5.
nwieters Nov 29, 2023
6aa7684
Added function to cluster phases after collecting them.
nwieters Nov 30, 2023
58e3729
Changes to pass all example tests.
nwieters Dec 1, 2023
ecf6bbb
Code optimizations
nwieters Dec 1, 2023
97d5d28
Removed unused function.
nwieters Dec 4, 2023
04d8ff0
Finished workflow tests.
nwieters Dec 4, 2023
16187d9
Changes in default workflow definition.
nwieters Dec 4, 2023
f26a115
Revive init_workflow funtion.
nwieters Dec 4, 2023
08d6976
Added my email to setup.py
nwieters Dec 4, 2023
7e1dd6b
Added comments and docstrings.
nwieters Dec 4, 2023
f57214d
Merge branch 'release' into sprint/workflow_manager
nwieters Dec 4, 2023
d1f5a21
Some more code improvements.
nwieters Dec 7, 2023
21fec58
Small changes in some comments.
nwieters Dec 8, 2023
67d08f8
Remove calc of nproc in workflow.py.
nwieters Dec 12, 2023
582caa1
Remove keyword run_on_queue (not used) and give error by missing run_…
nwieters Dec 12, 2023
698a523
Adapted log-file name and append mode.
nwieters Dec 13, 2023
bc6c082
Removed run_on_queue from default phases.
nwieters Dec 13, 2023
05a03ab
Removed run_on_queue.
nwieters Dec 13, 2023
8f75e6f
Added START and END statement to logfile of recipe steps.
nwieters Dec 13, 2023
4bfff6a
Added comments.
nwieters Dec 13, 2023
18fd44a
Added comments.
nwieters Dec 14, 2023
cdd7c20
Change comment
nwieters Dec 14, 2023
638a1ea
Adde jobid to logfiles.
nwieters Dec 14, 2023
ff0724c
Comment out unused functions.
nwieters Dec 15, 2023
e49eac8
Merge pull request #1171 from esm-tools/sprint/workflow_manager_docum…
nwieters Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions configs/esm_software/esm_runscripts/defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

per_model_defaults:
file_movements:
default:
all_directions: copy
bin:
init_to_exp: copy
exp_to_run: copy
run_to_work: copy
work_to_run: copy

file_movements:
default:
all_directions: copy
bin:
init_to_exp: copy
exp_to_run: copy
run_to_work: copy
work_to_run: copy
default_workflow_phases:
phases:
nwieters marked this conversation as resolved.
Show resolved Hide resolved
- prepcompute
- compute
- tidy
always_run_with:
- prepare
- prepexp
4 changes: 2 additions & 2 deletions configs/esm_software/esm_runscripts/esm_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ core:
- "initialize_experiment_logfile"
- "copy_tools_to_thisrun"
- "_copy_preliminary_files_from_experiment_to_thisrun"



prepcompute:
Expand Down Expand Up @@ -52,7 +52,7 @@ core:
- "throw_away_some_infiles"


observe:
observe:
- "init_monitor_file"
#- "get_last_jobid"
- "wait_and_observe"
Expand Down
39 changes: 38 additions & 1 deletion src/esm_plugin_manager/esm_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,26 @@ def read_recipe(recipe, additional_dict, needs_parse=True):


def read_plugin_information(plugins_bare, recipe, needs_parse=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this function at all haha. You seem to have understood it @nwieters, maybe you can clarify (again) to me the need of esm_plugins.yaml, one of the mysteries of ESM-Tools

# pluginfile = esm_plugins.yaml
"""
Reads in plugin information from the pluginfile = esm_plugins.yaml

Arguments:
plugins_bare -- disctionary as it is read in by function 'read_recipe'
recipe -- dictionary of all workitems of an recipe
needs_parse -- True (default) or False

Returns:
plugins - dictionary that has information for each workitem of recipe:
module: e.g. esm_runscripts
submodule: e.g. prepare (this is the Python file where the workitem function is defined.
type: e.g. core
nwieters marked this conversation as resolved.
Show resolved Hide resolved
"""
if needs_parse:
plugins_bare = yaml_file_to_dict(plugins_bare)
extra_info = ["location", "git-url"]
plugins = {}
# loop over all recipe entries
# tries to find workitem in 'plugins_bare'
for workitem in recipe["recipe"]:
found = False
for module_type in ["core", "plugins"]:
Expand All @@ -31,13 +46,22 @@ def read_plugin_information(plugins_bare, recipe, needs_parse=True):
for submodule in plugins_bare[module_type][module]:
if submodule in extra_info:
continue
# functionlist is a list of workitems (Python function names)
functionlist = plugins_bare[module_type][module][submodule]
# if the workitem of the recipe is found in this list
# the dictionary plugins will be filled with fields for
# - 'module' (e.g. esm_runscirpts)
# - 'submodule' (e.g. prepare, this is basically the name
# of the python file this function is defined in)
# - 'type' (core of plugin)
if workitem in functionlist:
plugins[workitem] = {
"module": module,
"submodule": submodule,
"type": module_type,
}
# add extra info ["location", "git-url"] if found in plugins_bare dict
# is there a use case for this?
for extra in extra_info:
if extra in plugins_bare[module_type][module]:
plugins[workitem].update(
Expand All @@ -47,6 +71,7 @@ def read_plugin_information(plugins_bare, recipe, needs_parse=True):
]
}
)
# if workitem is found, all loops including loop over module_type can be aborted.
found = True
break
if found:
Expand Down Expand Up @@ -117,11 +142,23 @@ def check_plugin_availability(plugins):


def work_through_recipe(recipe, plugins, config):
"""
Works through the esm_runscripts recipes and plugin recipes.

Arguments:
recipe -- dictionary # What is in these two dictionaries? Where do the entries are comming from?
plugins -- dictionary
config -- dictionary

Returns:
config
"""
nwieters marked this conversation as resolved.
Show resolved Hide resolved
if config.get("general", {}).get("debug_recipe", False):
import pdb

pdb.set_trace()
recipes = recipe["recipe"]
# Loop over the recipe
for index, workitem in enumerate(recipes, start=1):
if config["general"].get("verbose", False):
# diagnostic message of which recipe step is being executed
Expand Down
Loading
Loading