Skip to content

Conversation

@stephanie-wang
Copy link
Contributor

What do these changes do?

The default UniqueID() does not initialize the ID data, which can make statements like ObjectID object_id; error-prone. This merges the UniqueID::nil() static method into the default constructor.

Copy link
Contributor

@pcmoritz pcmoritz left a comment

Choose a reason for hiding this comment

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

LGTM conditionally on tests (esp. linting) passing.

Copy link
Collaborator

@robertnishihara robertnishihara left a comment

Choose a reason for hiding this comment

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

This looks good to me.

ClientTableDataT data;
gcs_client_2->client_table().GetClient(client_id_1, data);
RAY_LOG(INFO) << (ClientID::from_binary(data.client_id) == ClientID::nil());
RAY_LOG(INFO) << (ClientID::from_binary(data.client_id) == ClientID());
Copy link
Contributor

Choose a reason for hiding this comment

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

above we used .is_nil() for this, we might want to unify for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10106/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10107/
Test FAILed.

@raulchen
Copy link
Contributor

Actually I prefer keeping the UniqueID::nil() method, for 2 reasons:

  1. compared to UniqueID(), the meaning of UniqueID::nil() more clear. Users know this method returns a nil ID, without needing to refer to the document.
  2. With factory method UniqueID::nil(), we can actually cache one NIL instance for all use cases (assuming UniqueID is immutable). Compared to creating a new instance every time, this is more efficient.

But, it's good to initialize data to nil in the constructor.

@stephanie-wang
Copy link
Contributor Author

Thanks, @raulchen. I left in UniqueID::nil() method but changed it to return a reference to a static variable.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/10128/
Test PASSed.

@pcmoritz pcmoritz merged commit 26ca408 into ray-project:master Dec 18, 2018
@pcmoritz pcmoritz deleted the unique-id-nil branch December 18, 2018 19:59
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.

5 participants