Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AlyssaCote
Copy link
Contributor

@AlyssaCote AlyssaCote commented Mar 25, 2024

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 .err because Step holds a meta dictionary with the status_dir path where we want to write to. The symlinking logic was added to Controller._launch() to ensure that the output files are symlinked just before launching the steps.

@codecov
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 85.18519% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 78.97%. Comparing base (505de50) to head (8b60233).

❗ Current head 8b60233 differs from pull request most recent head 7c130ac. Consider uploading reports for the commit 7c130ac to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             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     
Files Coverage Δ
smartsim/_core/control/controller.py 71.35% <86.66%> (-14.57%) ⬇️
smartsim/_core/launcher/step/step.py 94.66% <83.33%> (-5.34%) ⬇️

... and 29 files with indirect coverage changes

@al-rigazzi al-rigazzi self-requested a review March 25, 2024 23:29
@AlyssaCote AlyssaCote requested a review from ashao March 25, 2024 23:31
Copy link
Collaborator

@al-rigazzi al-rigazzi left a 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!

Copy link
Member

@ashao ashao left a 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

:type entity: SmartSimEntity | EntitySequence[SmartSimEntity]
"""
historical_out, historical_err = job_step.get_output_files()
entity_out = osp.join(entity.path, f"{entity.name}.out")
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You got it!

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

Comment on lines 76 to 77
if not osp.exists(output_dir):
pathlib.Path(output_dir).mkdir(parents=True, exist_ok=True)
Copy link
Member

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.

Copy link
Contributor Author

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?

@AlyssaCote AlyssaCote requested review from al-rigazzi and ashao April 3, 2024 16:24
Copy link
Collaborator

@al-rigazzi al-rigazzi left a 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!

@AlyssaCote AlyssaCote requested a review from al-rigazzi April 8, 2024 21:21
Copy link
Collaborator

@al-rigazzi al-rigazzi left a 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!

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
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, fixing!

Copy link
Member

@ashao ashao left a 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!

Copy link
Member

@ashao ashao left a 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!

@AlyssaCote AlyssaCote merged commit 3edd895 into CrayLabs:develop Apr 10, 2024
@amandarichardsonn amandarichardsonn added type: feature Issues that include feature request or feature idea area: telemetry Issues related to dashboard telemetry repo: smartsim Issues related to SmartSim infrastructure library labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: telemetry Issues related to dashboard telemetry repo: smartsim Issues related to SmartSim infrastructure library type: feature Issues that include feature request or feature idea

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants