Conversation
…rkflow-checkout-tool
…DL/fre-cli into 697.workflow-checkout-tool
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
- Use TMPDIR env variable if command line option not passed
…rkflow-checkout-tool
|
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) |
ilaflott
left a comment
There was a problem hiding this comment.
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 |
fre/workflow/checkout_script.py
Outdated
| 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Oh that would definitiely get rid of the need for the def create_checkout function I added though 🎉
|
Note: I can also update the |
Opened an issue for removal: #760 |
Describe your changes
freworkflow.py,tests/,checkout_script.py,README.mdIssue ticket number and link (if applicable)
#697
Checklist before requesting a review