Skip to content
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

Experiment.start Returns Records #744

Open
wants to merge 3 commits into
base: smartsim-refactor
Choose a base branch
from

Conversation

MattToast
Copy link
Member

Basic implementation of a Record class to keep track of launched jobs. Convert Experiment.start return Records and all other methods to accept records.

@MattToast MattToast added area: job Issues related to job management area: api Issues related to API changes labels Oct 14, 2024
@MattToast MattToast self-assigned this Oct 14, 2024
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.

Project coverage is 47.46%. Comparing base (cce16e6) to head (e06bbac).
Report is 19 commits behind head on smartsim-refactor.

Files with missing lines Patch % Lines
smartsim/launchable/job.py 86.66% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##           smartsim-refactor     #744      +/-   ##
=====================================================
+ Coverage              40.45%   47.46%   +7.00%     
=====================================================
  Files                    110      109       -1     
  Lines                   7326     6590     -736     
=====================================================
+ Hits                    2964     3128     +164     
+ Misses                  4362     3462     -900     
Files with missing lines Coverage Δ
smartsim/_core/utils/helpers.py 41.43% <ø> (+1.25%) ⬆️
smartsim/experiment.py 88.53% <100.00%> (+6.98%) ⬆️
smartsim/launchable/job.py 93.84% <86.66%> (+3.36%) ⬆️

... and 12 files with indirect coverage changes

Copy link
Contributor

@amandarichardsonn amandarichardsonn left a comment

Choose a reason for hiding this comment

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

Some small suggestions!

smartsim/experiment.py Show resolved Hide resolved
smartsim/experiment.py Show resolved Hide resolved
smartsim/experiment.py Outdated Show resolved Hide resolved
smartsim/launchable/job.py Outdated Show resolved Hide resolved
:param launch_id: A unique identifier for the launch of the job.
:param job: The job that was launched.
"""
self._id = launch_id
Copy link
Contributor

@amandarichardsonn amandarichardsonn Oct 15, 2024

Choose a reason for hiding this comment

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

Why do you deep copying the Job but not the launch_id here?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, the launch_id (at least for now), is just a string that we ask the type checker to treat like a different type, and strings are immutable in python, so a "deepcopy of" and a "reference to" a string are functionally equivalent.

There is actually some special logic in copy.deepcopy so that, by default, it will just return the original reference to a string if its encounter without change.

TL;DR I was lazy and didn't want to spell out "deepcopy". More than willing to add it though if we think that LaunchedJobID might become a more substantive type in future!

smartsim/launchable/job.py Show resolved Hide resolved
smartsim/experiment.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API changes area: job Issues related to job management ignore-for-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants