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

chore(weave): Cleanup save object basic #3015

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

andrewtruong
Copy link
Collaborator

@andrewtruong andrewtruong commented Nov 19, 2024

Tidying this block

@@ -1335,13 +1335,13 @@ def _save_object_basic(
"""Directly saves an object to the weave server and attach
the ref to the object. This is the lowest level object saving logic.
"""
orig_val = val
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved to top for clarity

Comment on lines +1366 to +1367
# `to_json` is mostly fast, except for CustomWeaveTypes
# which incur network costs to serialize the payload
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved comment closer to code for clarity

digest_future: Future[str] = self.future_executor.then(
[res_future], lambda res: res[0].digest
)

ref: Ref
if is_opdef:
if is_op(orig_val):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

inline

ref = OpRef(self.entity, self.project, name, digest_future)
else:
ref = ObjectRef(self.entity, self.project, name, digest_future)

# Attach the ref to the object
try:
set_ref(orig_val, ref)
except:
except Exception:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@andrewtruong andrewtruong marked this pull request as ready for review November 19, 2024 15:36
@andrewtruong andrewtruong requested a review from a team as a code owner November 19, 2024 15:36
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.

1 participant