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

Update MLI docstrings part 2 #699

Merged
merged 13 commits into from
Sep 10, 2024
Merged

Conversation

AlyssaCote
Copy link
Contributor

@AlyssaCote AlyssaCote commented Sep 10, 2024

Part 2 of docstring updates! Keeping the description as a refresher.

I added and updated the MLI docstrings so that everything renders correctly and they are more consistent. This means I needed to make some decisions on what "consistent" means, because there were many different combinations going on. Feel free to push back on these! I just went with what looked like the best/what we were doing the most.

  • The docstring description uses punctuation to end the description.
  • The :param:, :returns:, etc do not use punctuation to end their description line UNLESS the line needs multiple sentences, in which case, use punctuation. (I think this happens once or twice).
  • All description lines are capitalized.

example:

def serialize_response(response: response_capnp.ResponseBuilder) -> bytes:
   """
   Serializes a built response message.

   :param response: Response to be serialized
   :returns: Serialized response bytes
   """
   return response.to_bytes()

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Please upload report for BASE (mli-feature@28bfd8f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...e/mli/infrastructure/control/request_dispatcher.py 0.00% 2 Missing ⚠️
...i/infrastructure/storage/backbone_feature_store.py 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##             mli-feature     #699   +/-   ##
==============================================
  Coverage               ?   69.50%           
==============================================
  Files                  ?      103           
  Lines                  ?     8750           
  Branches               ?        0           
==============================================
  Hits                   ?     6082           
  Misses                 ?     2668           
  Partials               ?        0           
Files with missing lines Coverage Δ
..._core/mli/infrastructure/control/device_manager.py 0.00% <ø> (ø)
..._core/mli/infrastructure/control/error_handling.py 0.00% <ø> (ø)
..._core/mli/infrastructure/control/worker_manager.py 0.00% <ø> (ø)
...sim/_core/mli/infrastructure/environment_loader.py 0.00% <ø> (ø)
...mli/infrastructure/storage/dragon_feature_store.py 0.00% <ø> (ø)
.../_core/mli/infrastructure/storage/feature_store.py 0.00% <ø> (ø)
smartsim/_core/mli/infrastructure/worker/worker.py 0.00% <ø> (ø)
smartsim/_core/mli/message_handler.py 99.52% <ø> (ø)
...i/infrastructure/storage/backbone_feature_store.py 0.00% <0.00%> (ø)
...e/mli/infrastructure/control/request_dispatcher.py 0.00% <0.00%> (ø)

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 great! I have a few comments that I'd like to be addressed and then I think it's good to merge


:param descriptor: The descriptor that uniquely identifies the resource
:returns: An attached DragonFLIChannel"""
:returns: An attached DragonFLIChannel
:raises: If creation of DragonFLIChanenel fails
Copy link
Collaborator

Choose a reason for hiding this comment

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

What type of error does it raise?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(if we raise whatever is raised by the underlying call, do we need to document it? Asking because I really don't know what we should do. Should we re-cast the Exception to something we own?)

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 I forgot to come back to this one! I actually don't know what error this raises, but I could raise a SmartSimError. As far as what to do about documenting exceptions and where, that's something I'm trying to work through in my error handling ticket as well. If we explicitly raise something here then I think we document 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.

For now, I just did :raises Exception: and I can make the changes to what exactly gets raised in the error handling ticket, if that's okay!

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, thanks for taking care of those small details I pointed out!

@AlyssaCote AlyssaCote merged commit 61ab71d into CrayLabs:mli-feature Sep 10, 2024
41 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants