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

Expose iotaa Graphviz output #417

Merged
merged 11 commits into from
Feb 28, 2024
Merged

Conversation

maddenp-noaa
Copy link
Collaborator

@maddenp-noaa maddenp-noaa commented Feb 27, 2024

Synopsis

iotaa has a feature to produce simple Graphviz DOT output depicting the state of a task graph. This PR exposes that feature for the two existing uw drivers. I wasn't sure how well this would work, so didn't try to get any buy-in on implementing this and understand that whether we want to release this may be questionable. But here it is, for consideration.

For example, here's an execution of uw sfc_climo_gen provisioned_run_directory with the @external-task input files currently unavailable:

% uw sfc_climo_gen provisioned_run_directory --config-file config-scg.yaml --graph-file scg.dot
[2024-02-27T18:01:17]     INFO Validating config per schema sfc-climo-gen
[2024-02-27T18:01:17]     INFO 0 UW schema-validation errors found
[2024-02-27T18:01:17]     INFO Validating config per schema platform
[2024-02-27T18:01:17]     INFO 0 UW schema-validation errors found
[2024-02-27T18:01:17]     INFO sfc_climo_gen provisioned run directory: Initial state: Pending
[2024-02-27T18:01:17]     INFO sfc_climo_gen provisioned run directory: Checking requirements
[2024-02-27T18:01:17]     INFO sfc_climo_gen namelist file fort.41: Initial state: Pending
[2024-02-27T18:01:17]     INFO sfc_climo_gen namelist file fort.41: Checking requirements
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/facsf.1.0.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/maximum_snow_albedo.0.05.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/slope_type.1.0.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/snowfree_albedo.4comp.0.05.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/soil_type.statsgo.0.05.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/substrate_temperature.2.6x1.5.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/vegetation_greenness.0.144.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/vegetation_type.igbp.0.05.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/C403_mosaic.halo4.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]  WARNING File /home/maddenp/git/uwtools/files/C403_oro_data.tile7.halo4.nc: State: Pending (EXTERNAL)
[2024-02-27T18:01:17]     INFO sfc_climo_gen namelist file fort.41: Requirement(s) pending
[2024-02-27T18:01:17]  WARNING sfc_climo_gen namelist file fort.41: Final state: Pending
[2024-02-27T18:01:17]     INFO sfc_climo_gen runscript: Initial state: Pending
[2024-02-27T18:01:17]     INFO sfc_climo_gen runscript: Checking requirements
[2024-02-27T18:01:17]     INFO sfc_climo_gen runscript: Requirement(s) ready
[2024-02-27T18:01:17]     INFO sfc_climo_gen runscript: Executing
[2024-02-27T18:01:17]     INFO sfc_climo_gen runscript: Final state: Ready
[2024-02-27T18:01:17]  WARNING sfc_climo_gen provisioned run directory: Final state: Pending

Here's rendering the DOT output in scg.dot to a PNG file:

% dot scg.dot -Grankdir=LR -Tpng -o scg.png

And here's the resulting png:
scg

After making some of the input files available:

% uw sfc_climo_gen provisioned_run_directory --config-file config-scg.yaml --graph-file scg.dot
[2024-02-27T18:10:39]     INFO Validating config per schema sfc-climo-gen
[2024-02-27T18:10:39]     INFO 0 UW schema-validation errors found
[2024-02-27T18:10:39]     INFO Validating config per schema platform
[2024-02-27T18:10:39]     INFO 0 UW schema-validation errors found
[2024-02-27T18:10:39]     INFO sfc_climo_gen provisioned run directory: Initial state: Pending
[2024-02-27T18:10:39]     INFO sfc_climo_gen provisioned run directory: Checking requirements
[2024-02-27T18:10:39]     INFO sfc_climo_gen namelist file fort.41: Initial state: Pending
[2024-02-27T18:10:39]     INFO sfc_climo_gen namelist file fort.41: Checking requirements
[2024-02-27T18:10:39]  WARNING File /home/maddenp/git/uwtools/files/vegetation_greenness.0.144.nc: State: Pending (EXTERNAL)
[2024-02-27T18:10:39]  WARNING File /home/maddenp/git/uwtools/files/vegetation_type.igbp.0.05.nc: State: Pending (EXTERNAL)
[2024-02-27T18:10:39]  WARNING File /home/maddenp/git/uwtools/files/C403_mosaic.halo4.nc: State: Pending (EXTERNAL)
[2024-02-27T18:10:39]  WARNING File /home/maddenp/git/uwtools/files/C403_oro_data.tile7.halo4.nc: State: Pending (EXTERNAL)
[2024-02-27T18:10:39]     INFO sfc_climo_gen namelist file fort.41: Requirement(s) pending
[2024-02-27T18:10:39]  WARNING sfc_climo_gen namelist file fort.41: Final state: Pending
[2024-02-27T18:10:39]     INFO sfc_climo_gen runscript: Initial state: Pending
[2024-02-27T18:10:39]     INFO sfc_climo_gen runscript: Checking requirements
[2024-02-27T18:10:39]     INFO sfc_climo_gen runscript: Requirement(s) ready
[2024-02-27T18:10:39]     INFO sfc_climo_gen runscript: Executing
[2024-02-27T18:10:39]     INFO sfc_climo_gen runscript: Final state: Ready
[2024-02-27T18:10:39]  WARNING sfc_climo_gen provisioned run directory: Final state: Pending

And the new PNG file from the new DOT code:
scg

Graphviz has different layout engines and lots of knobs to tweak to achieve more-or-less useful/interesting graphs, e.g.
scg

We could consider marking this feature EXPERIMENTAL in the CLI and avoid documenting it for now.

Type

  • Enhancement (adds a new functionality)

Impact

  • This is a non-breaking change (existing functionality continues to work as expected)

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.

@maddenp-noaa maddenp-noaa self-assigned this Feb 27, 2024
Copy link
Collaborator

@christinaholtNOAA christinaholtNOAA left a comment

Choose a reason for hiding this comment

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

Nice new experimental feature! :)

src/uwtools/cli.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@NaureenBharwaniNOAA NaureenBharwaniNOAA left a comment

Choose a reason for hiding this comment

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

LGTM!

@maddenp-noaa maddenp-noaa merged commit 4551265 into ufs-community:main Feb 28, 2024
2 checks passed
@maddenp-noaa maddenp-noaa deleted the graph branch February 28, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants