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] add runtime env info to task spec debug string #20631

Merged
merged 3 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/ray/common/task/task_spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,23 @@ std::string TaskSpecification::DebugString() const {
<< "}";
}

// Print runtime env.
if (HasRuntimeEnv()) {
const auto &runtime_env_info = RuntimeEnvInfo();
stream << ", serialized_runtime_env=" << SerializedRuntimeEnv();
const auto &uris = runtime_env_info.uris();
if (uris.size() > 0) {
stream << ", runtime_env_uris=";
for (const auto &uri : uris) {
stream << uri << ":";
}
// Erase the last ":"
stream.seekp(-1, std::ios_base::end);
}
stream << ", runtime_env_eager_install="
<< runtime_env_info.runtime_env_eager_install();
}

return stream.str();
}

Expand Down
7 changes: 6 additions & 1 deletion src/ray/common/task/task_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "ray/common/buffer.h"
#include "ray/common/ray_object.h"
#include "ray/common/task/task_spec.h"
#include "ray/util/logging.h"
#include "src/ray/protobuf/common.pb.h"

namespace ray {
Expand Down Expand Up @@ -87,7 +88,11 @@ class TaskSpecBuilder {
TaskSpecBuilder() : message_(std::make_shared<rpc::TaskSpec>()) {}

/// Build the `TaskSpecification` object.
TaskSpecification Build() { return TaskSpecification(message_); }
TaskSpecification Build() {
auto task_spec = TaskSpecification(message_);
RAY_LOG(DEBUG) << "Build task " << task_spec.DebugString();
return task_spec;
}

/// Get a reference to the internal protobuf message object.
const rpc::TaskSpec &GetMessage() const { return *message_; }
Expand Down
1 change: 0 additions & 1 deletion src/ray/core_worker/core_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,6 @@ std::vector<rpc::ObjectReference> CoreWorker::SubmitTask(
task_options.serialized_runtime_env);
builder.SetNormalTaskSpec(max_retries, retry_exceptions);
TaskSpecification task_spec = builder.Build();
RAY_LOG(DEBUG) << "Submit task " << task_spec.DebugString();
std::vector<rpc::ObjectReference> returned_refs;
if (options_.is_local_mode) {
returned_refs = ExecuteTaskLocalMode(task_spec);
Expand Down