-
Notifications
You must be signed in to change notification settings - Fork 3
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
First prototype of a code base #14
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b1c0d72
Initializes code for running a WC workflow with AiiDA
agoscinski ce5144b
Apply suggestions from code review
agoscinski 7a26582
Update README.rst with AiiDA installation and profile info
GeigerJ2 633ed77
fix typo
agoscinski f42101c
small update example README
agoscinski f0c5525
add submit to aiida_workgraph
agoscinski d2ecee9
fix recursive loop in __repr__ function
agoscinski fe64bf7
fix wrong date for unrolled dependencies
agoscinski 1943c5c
Update examples/README.rst
agoscinski 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 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 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 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,20 @@ | ||
API | ||
=== | ||
|
||
wcflow.wc | ||
--------- | ||
.. automodule:: wcflow.wc | ||
:members: | ||
:undoc-members: | ||
|
||
wcflow.core | ||
----------- | ||
.. automodule:: wcflow.core | ||
:members: | ||
:undoc-members: | ||
|
||
wcflow.workgraph | ||
---------------- | ||
.. automodule:: wcflow.workgraph | ||
:members: | ||
:undoc-members: |
This file contains 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 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 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
.. toctree:: | ||
|
||
getting_started.rst | ||
api.rst |
This file contains 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,12 @@ | ||
Running examples | ||
================ | ||
|
||
.. marker-example-text | ||
|
||
To run the example you can use the command | ||
|
||
.. code-block:: bash | ||
|
||
wcflow files/configs/example_config.yaml | ||
|
||
It is important to execute it from the examples folder as the relative paths are hardcoded. |
This file contains 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,181 @@ | ||
start_date: '2026-01-01T00:00' | ||
end_date: '2027-01-01T00:00' | ||
cycles: | ||
init: | ||
tasks: | ||
extpar: | ||
inputs: | ||
- obs_data: | ||
arg_option: "--input" | ||
outputs: | ||
- extpar_file | ||
icon_bimonthly: | ||
period: 'P2M' | ||
tasks: | ||
preproc: | ||
inputs: | ||
- grid_file: | ||
arg_option: "-g" | ||
- extpar_file: | ||
date: '2026-01-01T00:00' | ||
arg_option: "-p" | ||
- ERA5: | ||
arg_option: "-e" | ||
outputs: | ||
- icon_input | ||
depends: | ||
- icon: | ||
lag: '-P4M' | ||
icon: | ||
inputs: | ||
- grid_file: | ||
arg_option: "-g" | ||
- icon_input: | ||
arg_option: "--input" | ||
#- icon_restart: | ||
# lag: '-P2M' | ||
outputs: | ||
- stream_1 | ||
- stream_2 | ||
#- icon_restart | ||
postproc_1: | ||
inputs: | ||
- stream_1: | ||
arg_option: "--input" | ||
outputs: | ||
- postout_1 | ||
store_and_clean_1: | ||
inputs: | ||
- postout_1: | ||
arg_option: "--input" | ||
- stream_1: | ||
arg_option: "--stream" | ||
- icon_input: | ||
arg_option: "--icon_input" | ||
outputs: | ||
- stored_data_1 | ||
yearly: | ||
period: 'P1Y' | ||
tasks: | ||
postproc_2: | ||
inputs: | ||
- stream_2: | ||
lag: | ||
- 'P0M' | ||
arg_option: "--input" | ||
outputs: | ||
- postout_2 | ||
store_and_clean_2: | ||
inputs: | ||
- postout_2: | ||
arg_option: "--input" | ||
- stream_2: | ||
lag: | ||
- 'P0M' | ||
outputs: | ||
- stored_data_2 | ||
# Each task and piece of data (input and output of tasks) used to | ||
# define the graph is described in that section | ||
tasks: | ||
root: | ||
# All tasks inherit the root task properties | ||
host: santis | ||
account: g110 | ||
extpar: | ||
plugin: extpar | ||
command: $PWD/files/scripts/extpar | ||
command_option: "--verbose" # todo implement support | ||
config: path/to/namelists/dir | ||
uenv: | ||
squashfs: path/to/squashfs | ||
mount_point: runtime/mount/point | ||
nodes: 1 | ||
walltime: '00:02:00' | ||
preproc: | ||
plugin: AiiDA Shell | ||
command: $PWD/files/scripts/cleanup.sh | ||
nodes: 4 | ||
walltime: '00:02:00' | ||
config: path/to/config/dir | ||
uenv: | ||
squashfs: path/to/squashfs | ||
mount_point: runtime/mount/point | ||
icon: | ||
plugin: icon | ||
command: $PWD/files/scripts/icon | ||
nodes: 40 | ||
walltime: '23:59:59' | ||
config: path/to/namelists/dir | ||
uenv: | ||
squashfs: path/to/squashfs | ||
mount_point: runtime/mount/point | ||
postproc_1: | ||
plugin: AiiDA Shell | ||
command: $PWD/files/scripts/main_script_ocn.sh | ||
nodes: 2 | ||
walltime: '00:05:00' | ||
conda_env: path/to/yaml/env/file | ||
uenv: | ||
squashfs: path/to/squashfs | ||
mount_point: runtime/mount/point | ||
postproc_2: | ||
plugin: AiiDA Shell | ||
command: $PWD/files/scripts/main_script_atm.sh | ||
nodes: 2 | ||
walltime: '00:05:00' | ||
src: path/to/src/dir | ||
conda_env: path/to/yaml/env/file | ||
uenv: | ||
squashfs: path/to/squashfs | ||
mount_point: runtime/mount/point | ||
store_and_clean_1: | ||
plugin: AiiDA Shell | ||
command: $PWD/files/scripts/post_clean.sh | ||
nodes: 1 | ||
walltime: '00:01:00' | ||
store_and_clean_2: | ||
plugin: AiiDA Shell | ||
command: $PWD/files/scripts/post_clean.sh | ||
nodes: 1 | ||
walltime: '00:01:00' | ||
data: | ||
preproc_output: | ||
type: file | ||
src: $PWD/files/data/file.ncdf | ||
grid_file: | ||
type: file | ||
src: $PWD/files/data/grid | ||
obs_data: | ||
type: file | ||
src: $PWD/files/data/obs_data | ||
ERA5: | ||
type: file | ||
src: $PWD/files/data/era5 | ||
extpar_file: | ||
type: file | ||
src: output | ||
icon_input: | ||
type: file | ||
src: output | ||
icon_restart: | ||
type: file | ||
format: ncdf | ||
src: restart | ||
stream_1: | ||
type: file | ||
src: output_1 | ||
stream_2: | ||
type: file | ||
src: output_2 | ||
postout_1: | ||
type: file | ||
src: postout | ||
postout_2: | ||
type: file | ||
src: postout | ||
stored_data_1: | ||
type: file | ||
src: stored_data | ||
stored_data_2: | ||
type: file | ||
src: stored_data |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains 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,9 @@ | ||
#!/usr/bin/env python | ||
|
||
def main(): | ||
# Main script execution continues here | ||
print("Cleaning") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains 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 @@ | ||
echo "cleanup" > output |
This file contains 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 @@ | ||
echo "extpar" > output |
This file contains 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,4 @@ | ||
echo "icon" > restart | ||
echo "icon" > output | ||
echo "icon" > output_1 | ||
echo "icon" > output_2 |
This file contains 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,41 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
from pathlib import Path | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='A simple script with an optional restart argument.') | ||
parser.add_argument('icon_input', type=str, help='The icon input.') | ||
parser.add_argument('--restart', nargs='?', type=str, help='The icon restart file.') | ||
#parser.add_argument('--restart', nargs='?', const='default', type=str, help='Initiate a restart operation with an optional string argument.') | ||
|
||
|
||
args = parser.parse_args() | ||
|
||
output = Path('output') | ||
output.write_text("") | ||
|
||
if args.restart: | ||
restart = Path(args.restart) | ||
restart.read_text() | ||
text = "Restart operation initiated..." | ||
print(text) | ||
with output.open("a") as f: | ||
f.write(text) | ||
else: | ||
text = "No restart option provided. Continuing without restart." | ||
print(text) | ||
with output.open("a") as f: | ||
f.write(text) | ||
|
||
# Main script execution continues here | ||
text = "Script execution continues..." | ||
print(text) | ||
with output.open("a") as f: | ||
f.write(text) | ||
|
||
restart = Path('restart') | ||
restart.write_text("") | ||
|
||
if __name__ == '__main__': | ||
main() |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't be needed with actual ICON, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How we integrate plugins is still an open question. But with the aiida builder we can get call input arguments and could technically support them, at least we can specify all orm data types that can be specified in a yaml file which should be most of them.