Skip to content

697.workflow checkout tool#736

Open
singhd789 wants to merge 45 commits intomainfrom
697.workflow-checkout-tool
Open

697.workflow checkout tool#736
singhd789 wants to merge 45 commits intomainfrom
697.workflow-checkout-tool

Conversation

@singhd789
Copy link
Contributor

@singhd789 singhd789 commented Feb 11, 2026

Describe your changes

  • transfer fre pp checkout functionality to fre workflow checkout
  • add "workflow" section to the settings yaml (for now) to define a repo and branch to use for the pp workflow (and eventually the run workflow)
  • add fre/workflow folder with freworkflow.py, tests/, checkout_script.py, README.md
  • add "workflow" tool to fre.py

Issue ticket number and link (if applicable)

#697

Checklist before requesting a review

  • I ran my code
  • I tried to make my code readable
  • I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback
  • No print statements; all user-facing info uses logging module

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.36%. Comparing base (ad432b1) to head (6ce4930).

Files with missing lines Patch % Lines
fre/workflow/checkout_script.py 83.56% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #736      +/-   ##
==========================================
+ Coverage   84.08%   84.36%   +0.28%     
==========================================
  Files          70       73       +3     
  Lines        4775     4906     +131     
==========================================
+ Hits         4015     4139     +124     
- Misses        760      767       +7     
Flag Coverage Δ
unittests 84.36% <90.90%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
fre/__init__.py 100.00% <100.00%> (ø)
fre/fre.py 100.00% <ø> (ø)
fre/workflow/freworkflow.py 100.00% <100.00%> (ø)
fre/workflow/tests/test_checkout_script.py 100.00% <100.00%> (ø)
fre/workflow/checkout_script.py 83.56% <83.56%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad432b1...6ce4930. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@singhd789 singhd789 linked an issue Feb 18, 2026 that may be closed by this pull request
@singhd789
Copy link
Contributor Author

singhd789 commented Feb 25, 2026

Note: related PR --> NOAA-GFDL/gfdl_msd_schemas#45 (we'll get the schema PR in first so I can bring in the changes to the submodule here)

@singhd789 singhd789 marked this pull request as ready for review February 25, 2026 22:55
Copy link
Member

@ilaflott ilaflott left a comment

Choose a reason for hiding this comment

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

is this replacing any functionality elsewhere- i.e. fre pp checkout? if so, the deprecated code should be id'd for removal

@singhd789
Copy link
Contributor Author

is this replacing any functionality elsewhere- i.e. fre pp checkout? if so, the deprecated code should be id'd for removal

YES! Thank you for that reminder

Comment on lines +157 to +172
if not Path(f"{src_dir}/{workflow_name}").is_dir():
fre_logger.info("Workflow does not yet exist; will create now")
create_checkout(repo = repo,
tag = tag,
src_dir = src_dir,
workflow_name = workflow_name)
elif Path(f"{src_dir}/{workflow_name}").is_dir() and force_checkout:
fre_logger.warning(" *** PREVIOUS CHECKOUT FOUND: %s/%s *** ", src_dir, workflow_name)
# Remove checked out repo
shutil.rmtree(f"{src_dir}/{workflow_name}")
fre_logger.warning(" *** REMOVING %s/%s *** ", src_dir, workflow_name)
# Redo checkout
create_checkout(repo = repo,
tag = tag,
src_dir = src_dir,
workflow_name = workflow_name)
Copy link
Member

Choose a reason for hiding this comment

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

similar to my other comment, these three conditionals can likely be collapsed.

i think you're trying to be explicit with if/elif/else blocks, but when the blocks are too similar in functionality, that tends to create confusion as big similar blocks of code are actually hard to read for only the differences.

one thing you can do to simplify this block of flow control, is to put some of the features you want here on their own terms. example: if force_checkout is True, then you can check for the existence of f"{src_dir}/{workflow_name}" in it's own statement before this whole block, and remove it if so.

Copy link
Contributor Author

@singhd789 singhd789 Feb 26, 2026

Choose a reason for hiding this comment

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

Ah yeah, ok so would it be better (or kind of the same) to have something like:

if Path(...).exists():
    if force_checkout:
        (warnings and removing)
    else: 
        (whole tag check logic)
else:
    (actual checkout)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that would definitiely get rid of the need for the def create_checkout function I added though 🎉

@singhd789
Copy link
Contributor Author

singhd789 commented Feb 26, 2026

Note: I can also update the validate_yamls function that already lives in fre/yamltools/helpers and import/use that one here. However, that would require updating other files (like in fre make). They would probably be little changes BUT should I do that in another PR (to not add too much more here)? Or should I just get it over with in this PR?

@singhd789
Copy link
Contributor Author

singhd789 commented Feb 26, 2026

is this replacing any functionality elsewhere- i.e. fre pp checkout? if so, the deprecated code should be id'd for removal

Opened an issue for removal: #760

@singhd789 singhd789 requested a review from ilaflott February 26, 2026 19:34
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.

FRE workflow checkout subtool

2 participants