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

[core] Switch Async Callback to C++ [WIP] #9228

Merged
merged 15 commits into from
Jul 7, 2020

Conversation

ijrsvt
Copy link
Contributor

@ijrsvt ijrsvt commented Jul 1, 2020

Why are these changes needed?

The current implementation of Async functionality for ObjectIDs is confusing and spread out between C++ and Python. This PR moves as much logic as possible into C++.

Related issue number

Closes #9251
Supercedes #9161

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/latest/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failure rates at https://ray-travis-tracker.herokuapp.com/.
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested (please justify below)

@ijrsvt ijrsvt requested review from edoakes and simon-mo July 1, 2020 00:55
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@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/27741/
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/27743/
Test FAILed.

@edoakes
Copy link
Contributor

edoakes commented Jul 1, 2020

@ijrsvt looks great! Could you make a full PR that removes the old code?

@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/27779/
Test FAILed.

@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/27795/
Test PASSed.

@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/27804/
Test PASSed.

Copy link
Contributor

@simon-mo simon-mo left a comment

Choose a reason for hiding this comment

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

This is awesome!!!

src/ray/core_worker/core_worker.cc Outdated Show resolved Hide resolved
python/ray/experimental/async_api.py Outdated Show resolved Hide resolved
src/ray/core_worker/core_worker.h Show resolved Hide resolved
using PlasmaSubscriptionCallback = std::function<void(ray::ObjectID, int64_t, int64_t)>;

/// Set callback when an item is added to the plasma store.
/// Perform async get from in-memory store.
Copy link
Contributor

Choose a reason for hiding this comment

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

this also does retrying?

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 do you mean? in terms of fetching from Plasma?

python/ray/experimental/test/async_test.py Show resolved Hide resolved
absl::flat_hash_map<ObjectID, std::vector<std::function<void(void)>>>
async_plasma_callbacks_ GUARDED_BY(plasma_mutex_);

void PlasmaCallback(SetResultCallback success, std::shared_ptr<RayObject> ray_object,
Copy link
Contributor

Choose a reason for hiding this comment

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

PlasmaCallback needs a comment

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, this handler is for GetAsync falling back to plasma?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep!

src/ray/core_worker/core_worker.cc Outdated Show resolved Hide resolved
Comment on lines +1994 to +1996
if (Get(std::vector<ObjectID>{object_id}, 0, &vec).ok() && vec.size() > 0) {
return success(vec.front(), object_id, py_future);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this case for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any case where the object is immediately available, but not in Memory. Calling before subscribe avoids filling subscribe with unnecessary object ids.

@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/27875/
Test FAILed.

@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/27907/
Test PASSed.

@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/27909/
Test FAILed.

@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/27954/
Test 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.

Aysyncio ObjectID becomes None
4 participants