-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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]create internal module for thridparty system compatible building #44066
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1156a3c
create internal module for thridparty system compatible building
ashione 32af9aa
Merge branch 'master' into revert-internal-module-removed
ashione 4c5a444
attach exported internal symbol to java so and _raylet lib
ashione 129ce73
Merge remote-tracking branch 'origin/revert-internal-module-removed' …
ashione 931c21c
Merge remote-tracking branch 'origin/master' into revert-internal-mod…
ashione 9a5f351
export tag name function
ashione b4899db
add tagkey name in internal
ashione 8a20e02
export aligned symbols
ashione File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright 2020 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "ray/internal/internal.h" | ||
|
||
#include "ray/core_worker/core_worker.h" | ||
|
||
namespace ray { | ||
namespace internal { | ||
|
||
using ray::core::CoreWorkerProcess; | ||
using ray::core::TaskOptions; | ||
|
||
std::vector<rpc::ObjectReference> SendInternal( | ||
const ActorID &peer_actor_id, | ||
std::shared_ptr<LocalMemoryBuffer> buffer, | ||
RayFunction &function, | ||
int return_num, | ||
int max_retries, | ||
bool retry_exceptions, | ||
std::string serialized_retry_exception_allowlist) { | ||
std::unordered_map<std::string, double> resources; | ||
std::string name = function.GetFunctionDescriptor()->DefaultTaskName(); | ||
TaskOptions options{name, return_num, resources}; | ||
|
||
char meta_data[3] = {'R', 'A', 'W'}; | ||
std::shared_ptr<LocalMemoryBuffer> meta = | ||
std::make_shared<LocalMemoryBuffer>((uint8_t *)meta_data, 3, true); | ||
|
||
std::vector<std::unique_ptr<TaskArg>> args; | ||
if (function.GetLanguage() == Language::PYTHON) { | ||
auto dummy = "__RAY_DUMMY__"; | ||
std::shared_ptr<LocalMemoryBuffer> dummyBuffer = | ||
std::make_shared<LocalMemoryBuffer>((uint8_t *)dummy, 13, true); | ||
args.emplace_back(new TaskArgByValue(std::make_shared<RayObject>( | ||
std::move(dummyBuffer), meta, std::vector<rpc::ObjectReference>(), true))); | ||
} | ||
args.emplace_back(new TaskArgByValue(std::make_shared<RayObject>( | ||
std::move(buffer), meta, std::vector<rpc::ObjectReference>(), true))); | ||
|
||
std::vector<std::shared_ptr<RayObject>> results; | ||
std::vector<rpc::ObjectReference> return_refs; | ||
auto result = CoreWorkerProcess::GetCoreWorker().SubmitActorTask( | ||
peer_actor_id, | ||
function, | ||
args, | ||
options, | ||
max_retries, | ||
retry_exceptions, | ||
serialized_retry_exception_allowlist, | ||
return_refs); | ||
if (!result.ok()) { | ||
RAY_CHECK(false) << "Back pressure should not be enabled."; | ||
} | ||
return return_refs; | ||
} | ||
|
||
const ray::stats::TagKeyType TagRegister(const std::string tag_name) { | ||
return ray::stats::TagKeyType::Register(tag_name); | ||
} | ||
|
||
const ActorID &GetCurrentActorID() { | ||
return CoreWorkerProcess::GetCoreWorker().GetWorkerContext().GetCurrentActorID(); | ||
} | ||
|
||
bool IsInitialized() { return CoreWorkerProcess::IsInitialized(); } | ||
|
||
} // namespace internal | ||
} // namespace ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2020 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
#include "ray/common/buffer.h" | ||
#include "ray/common/id.h" | ||
#include "ray/core_worker/common.h" | ||
#include "ray/stats/metric.h" | ||
|
||
// This header is used to warp some internal code so we can reduce suspicious | ||
// symbols export. | ||
namespace ray { | ||
namespace internal { | ||
|
||
using ray::core::RayFunction; | ||
|
||
/// Send buffer internal | ||
/// \param[in] buffer buffer to be sent. | ||
/// \param[in] function the function descriptor of peer's function. | ||
/// \param[in] return_num return value number of the call. | ||
/// \param[in] max_retirs task retries time. | ||
/// \param[in] retry_execptions whether retry if execptions found. | ||
/// \param[in] serialized_retry_exception_allowlist specificed allowed exceptions. | ||
/// \param[out] return_ids return ids from SubmitActorTask. | ||
std::vector<rpc::ObjectReference> SendInternal( | ||
const ActorID &peer_actor_id, | ||
std::shared_ptr<LocalMemoryBuffer> buffer, | ||
RayFunction &function, | ||
int return_num, | ||
int max_retries = -1, | ||
bool retry_exceptions = false, | ||
std::string serialized_retry_exception_allowlist = ""); | ||
|
||
const stats::TagKeyType TagRegister(const std::string tag_name); | ||
|
||
/// Get current actor id via internal. | ||
const ActorID &GetCurrentActorID(); | ||
ashione marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Get core worker initialization flag via internal. | ||
bool IsInitialized(); | ||
} // namespace internal | ||
} // namespace ray |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments to the code saying where it's used so people don't accidentally delete it again in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments had been added in internal header file.