-
Notifications
You must be signed in to change notification settings - Fork 38
Store SmartSim entity logs under the .smartsim directory #532
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #532 +/- ##
============================================
- Coverage 90.76% 78.97% -11.80%
============================================
Files 65 65
Lines 4528 4528
============================================
- Hits 4110 3576 -534
- Misses 418 952 +534
|
al-rigazzi
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 pretty good! Giving some quick feedback, while I dig a bit deeper into the tests you wrote. Good job so far!
ashao
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.
Almost looks ready to me. A couple of minor points to make, but overall a nice clean implementation
smartsim/_core/control/controller.py
Outdated
| :type entity: SmartSimEntity | EntitySequence[SmartSimEntity] | ||
| """ | ||
| historical_out, historical_err = job_step.get_output_files() | ||
| entity_out = osp.join(entity.path, f"{entity.name}.out") |
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 think we're moving towards pathlib instead of os.path. If so and because these are always just local variables, could you change the entity_out and entity_err to Path objects and update the other os operations to use pathlib intrinsics intead.
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.
You got it!
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.
It looks like entities that call get_output_files expect to return strings. Should I start changing all those instances to expect pathlib.Path instead? Or leave it?
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.
What I did instead was cast historical_out and historical_err once they're in the symlink function.
smartsim/_core/launcher/step/step.py
Outdated
| if not osp.exists(output_dir): | ||
| pathlib.Path(output_dir).mkdir(parents=True, exist_ok=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.
It seems a little odd to have this routine have two effects (1) return the paths to the output and error files and (2) create an output directory. Is there another place where these two lines make more sense.
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.
Definitely! I'll break it out into its own function and I could either call the new function from within get_output_files or I could call it within _launch_step right before I call get_output_files. Any preference?
al-rigazzi
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.
A couple of questions, but otherwise looks good!
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.
LGTM!
Only the changelog entry to be made consistent with the docstrings for symlinking... the rest looks great! Thanks for the prompt responses to my questions and for this quality-of-life improvement!
doc/changelog.rst
Outdated
| Detailed Notes | ||
|
|
||
| - The dashboard needs to display historical logs, so log files are written | ||
| out under the .smartsim directory and symlinked to the files in the |
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.
Pedantic, but... aren't we actually symlinking the ones in the experiment directory to the ones under .smartsim?
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.
oops, fixing!
ashao
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.
A couple of last very minor changes. Thanks for the work on this and a very nice clean implementation!
ashao
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.
Good to go. Thanks @AlyssaCote!
This PR's goal is to keep historical entity output files and store them under the .smartsim directory. In order to maintain consistency with what users expect to see in their file structure, we symlink to the output files in the experiment directory.
Step.get_output_files()is where the output files were changed so that they could be written to.smartsim/telemetry/{experiment_name}/{run_id}/{entity_type}/{entity_name}/{entity_name}.out or .errbecauseStepholds ametadictionary with thestatus_dirpath where we want to write to. The symlinking logic was added toController._launch()to ensure that the output files are symlinked just before launching the steps.