-
Notifications
You must be signed in to change notification settings - Fork 4
Support for Model output endpoint me.org #332
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #332 +/- ##
==========================================
+ Coverage 68.28% 69.60% +1.32%
==========================================
Files 21 21
Lines 1157 1214 +57
==========================================
+ Hits 790 845 +55
- Misses 367 369 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ccarouge
left a comment
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.
Since Sean is away, I've started looking at the PR. I haven't reacquainted myself completely with benchcab so for the moment most of my comments are not much on the structure. I'll need more time for that to come.
src/benchcab/data/meorg_jobscript.j2
Outdated
| if [ ! -z "${MODEL_OUTPUT_ID}" ] ; then | ||
| echo "Deleting existing files from model output ID" | ||
| $MEORG_BIN file delete_all $MODEL_OUTPUT_ID | ||
| echo "Updated model output ID" |
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.
I don't understand why we need this output here.
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.
If a model output ID already exists with a given name, we want to preserve the model output ID (since in case we assume that the user is re-running the same experiment). However, we want to clean up any existing files, so that the experiment runs with the intended files of the user. (I have added a short comment on the same)
src/benchcab/data/meorg_jobscript.j2
Outdated
| sleep $CACHE_DELAY | ||
|
|
||
| {% for exp_id in model_exp_ids %} | ||
| echo "Replace benchmarks to model output" |
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.
Using "Add benchmarks ..." in the output would make more sense to me than "Replace"
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.
I have updated the comment to "Add". The reason I chose "Replace" was, unlike adding experiments, if a benchmark already exists and we use meorg benchmark update, the existing benchmarks get overwritten (but yeah I don't see a use case for the user to not add benchmarks from scratch everytime in this workflow).
src/benchcab/config.py
Outdated
| ---------- | ||
| config : dict | ||
| The configuration file with with/without optional keys | ||
| The configuration file with without optional keys |
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.
Neither "with without optional keys" nor "with/without optional keys" make any sense. Any idea what we are trying to say here?
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.
I believe it's like the user may already have passed in the optional key (thus not replacing it), otherwise if the config file is without the necessary optional key, it would be replaced by a value calculated in read_optional_key.
tests/test_config.py
Outdated
| "modules": ["intel-compiler/2021.1.1", "netcdf/4.7.4", "openmpi/4.1.0"], | ||
| "realisations": [ | ||
| {"repo": {"svn": {"branch_path": "trunk"}}}, | ||
| {"repo": {"svn": {"branch_path": "trunk"}}, "model_output_name": True}, |
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.
Ideally, this should return an error because just using the name "trunk" for the model output name should not be allowed.
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.
I have added in the validation function for checking model output name derived from config file, along with tests.
ccarouge
left a comment
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.
Second batch of comments. It tends to come bits by bits sorry.
I believe the benchcab's User Guide needs some modifications which are missing from this PR.
src/benchcab/config.py
Outdated
| mo_name = None | ||
| if r.get("name"): | ||
| mo_name = r["name"] | ||
| else: | ||
| repo = create_repo( | ||
| spec=r["repo"], | ||
| path=internal.SRC_DIR / (r["name"] if r.get("name") else Path()), | ||
| ) | ||
| mo_name = Model(repo).name |
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.
I would revert to the previous implementation but using the name argument in create_repo()
| mo_name = None | |
| if r.get("name"): | |
| mo_name = r["name"] | |
| else: | |
| repo = create_repo( | |
| spec=r["repo"], | |
| path=internal.SRC_DIR / (r["name"] if r.get("name") else Path()), | |
| ) | |
| mo_name = Model(repo).name | |
| mo_name = None | |
| repo = create_repo( | |
| spec=r["repo"], | |
| path=internal.SRC_DIR / (r["name"] if r.get("name") else Path()), | |
| name=r.get("name"), | |
| ) | |
| mo_name = Model(repo).name |
The implementation of Model().__init__() should assign to Model(repo).name:
- the branch name if
nameis not present in the config - the value of
nameif it's present.
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.
To resolve this, I am using r.get("name") both in Repo and Model initialisations since Model cannot determine the name just from Repo (unless it has a mandatory name parameter, which it doesn't for all the sub classes - for example LocalRepo has name but GitRepo doesn't)
repo = create_repo(
spec=r["repo"],
path=internal.SRC_DIR / (r["name"] if r.get("name") else Path()),
)
mo_name = Model(repo, name=r.get("name")).nameFor now, I'm not making it mandatory for Repo to have a name parameter (so usage of r.get("name") twice is fine.
src/benchcab/config.py
Outdated
| return "Model output name does not start with number" | ||
|
|
||
| if len(name_keywords) == 1: | ||
| return "Model output name does not contain keyword after number" |
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.
I'm suggesting to change the error messages to be more direct, always using an affirmative sentence and importantly giving an example.
| return "Model output name does not contain keyword after number" | |
| return "Model output name must contain keywords after the initial number. E.g. 123-fixing-met-file-reading-error" |
I also wonder if we want to build an error message that indicates all the mistakes in a given name at once, instead of returning on the first error encountered. Something like the following (incomplete and not formatted for the code):
msg=""
if len(name) == 0:
msg+="Model output name can not be empty.\n"
if len(name) > 255:
msg+="The length of model output name must be shorter than 255 characters.\n"
if msg:
msg+="Example valid name: 123-fixing-met-file-reading-error"
return msgActually, the check on len(name)==0 indicates a problem with the code itself rather than the config I suspect so it might be weird to give a valid name example but I think it's a small inconvenience.
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.
For the check on len(name)==0, I'm trying to treat the function as independent entity from the code (so if the code does have issues in the future, then it would be caught more easily). Let me know if this check is still not needed.
|
@abhaasgoyal I won't have much time to continue the review. I'll let @SeanBryan51 have a look. Sorry for switching reviewer all the time! |
|
Hi @abhaasgoyal, as I understand these changes require CABLE-LSM/meorg_client#67. Can we merge that PR first and push a new meorg release so that in this PR we can update the minimum meorg version in meta.yaml and benchcab-dev.yaml? |
|
@SeanBryan51, yes happy to get that merged in first before merging this |
|
Hi @abhaasgoyal, now that CABLE-LSM/meorg_client#67 is merged and we have a new 0.5.0 release, please update the minimum meorg version in meta.yaml and benchcab-dev.yaml |
|
About design decision recommendations for determining model output name:
|
|
Hi @abhaasgoyal, thanks for the update. In the meeting I suggested checking the issue number (inferred from Apologies for being pedantic about these things |
|
I discussed with Gab about the hash structure for
So for now, the proposed hash is @SeanBryan51 I'll create an separate issue for validating |
SeanBryan51
left a comment
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.
Looks good! Just a small english rewording suggestion for the doc.
Co-authored-by: Sean Bryan <39685865+SeanBryan51@users.noreply.github.com>
6b3bc74 to
726d4e9
Compare
Resolves #331
Create a workflow for
benchcabnot requiring for the user to entermodel_output_idanymore. Instead, the user needs to specify which branch should be chosen as themodel_output_name, from whichbenchcabdoes the necessary workflow.Uses the new API endpoints from
me.orgAPI v3.0.0 (see CABLE-LSM/meorg_client#67 for more details)