From 96148a6cc6d3c022b646f8979ea7ebc01dbff051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=85=E9=BE=99?= Date: Mon, 22 Nov 2021 19:04:12 +0800 Subject: [PATCH 1/3] add build task log --- src/ray/common/task/task_spec.cc | 17 +++++++++++++++++ src/ray/common/task/task_util.h | 7 ++++++- src/ray/core_worker/core_worker.cc | 1 - 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ray/common/task/task_spec.cc b/src/ray/common/task/task_spec.cc index 2bf888ad7164..8ae5429cd935 100644 --- a/src/ray/common/task/task_spec.cc +++ b/src/ray/common/task/task_spec.cc @@ -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(); } diff --git a/src/ray/common/task/task_util.h b/src/ray/common/task/task_util.h index ce23631a8640..76f56ed45631 100644 --- a/src/ray/common/task/task_util.h +++ b/src/ray/common/task/task_util.h @@ -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 { @@ -87,7 +88,11 @@ class TaskSpecBuilder { TaskSpecBuilder() : message_(std::make_shared()) {} /// 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_; } diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index 8ce560a58fe9..2f7d495e6727 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -1864,7 +1864,6 @@ std::vector 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 returned_refs; if (options_.is_local_mode) { returned_refs = ExecuteTaskLocalMode(task_spec); From fe3af05eb560728a2a9c00097888ff99b893b1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=85=E9=BE=99?= Date: Mon, 22 Nov 2021 20:08:56 +0800 Subject: [PATCH 2/3] address comments --- src/ray/common/task/task_util.h | 7 +------ src/ray/core_worker/core_worker.cc | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ray/common/task/task_util.h b/src/ray/common/task/task_util.h index 76f56ed45631..ce23631a8640 100644 --- a/src/ray/common/task/task_util.h +++ b/src/ray/common/task/task_util.h @@ -17,7 +17,6 @@ #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 { @@ -88,11 +87,7 @@ class TaskSpecBuilder { TaskSpecBuilder() : message_(std::make_shared()) {} /// Build the `TaskSpecification` object. - TaskSpecification Build() { - auto task_spec = TaskSpecification(message_); - RAY_LOG(DEBUG) << "Build task " << task_spec.DebugString(); - return task_spec; - } + TaskSpecification Build() { return TaskSpecification(message_); } /// Get a reference to the internal protobuf message object. const rpc::TaskSpec &GetMessage() const { return *message_; } diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index 2f7d495e6727..b452b6b123a0 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -1864,6 +1864,7 @@ std::vector CoreWorker::SubmitTask( task_options.serialized_runtime_env); builder.SetNormalTaskSpec(max_retries, retry_exceptions); TaskSpecification task_spec = builder.Build(); + RAY_LOG(DEBUG) << "Submit normal task " << task_spec.DebugString(); std::vector returned_refs; if (options_.is_local_mode) { returned_refs = ExecuteTaskLocalMode(task_spec); @@ -1948,6 +1949,7 @@ Status CoreWorker::CreateActor(const RayFunction &function, << "Actor " << actor_id << " already exists"; *return_actor_id = actor_id; TaskSpecification task_spec = builder.Build(); + RAY_LOG(DEBUG) << "Submit actor creation task " << task_spec.DebugString(); if (options_.is_local_mode) { // TODO(suquark): Should we consider namespace in local mode? Currently // it looks like two actors with two different namespaces become the @@ -2125,6 +2127,7 @@ std::vector CoreWorker::SubmitActorTask( // Submit task. TaskSpecification task_spec = builder.Build(); + RAY_LOG(DEBUG) << "Submit actor task " << task_spec.DebugString(); std::vector returned_refs; if (options_.is_local_mode) { returned_refs = ExecuteTaskLocalMode(task_spec, actor_id); From 155c69ae3b0bb2c8494ada412cf9e80f5a9b09d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=85=E9=BE=99?= Date: Mon, 22 Nov 2021 20:11:35 +0800 Subject: [PATCH 3/3] fix --- src/ray/core_worker/core_worker.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index b452b6b123a0..397b9393bc1a 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -1864,7 +1864,7 @@ std::vector CoreWorker::SubmitTask( task_options.serialized_runtime_env); builder.SetNormalTaskSpec(max_retries, retry_exceptions); TaskSpecification task_spec = builder.Build(); - RAY_LOG(DEBUG) << "Submit normal task " << task_spec.DebugString(); + RAY_LOG(DEBUG) << "Submitting normal task " << task_spec.DebugString(); std::vector returned_refs; if (options_.is_local_mode) { returned_refs = ExecuteTaskLocalMode(task_spec); @@ -1949,7 +1949,7 @@ Status CoreWorker::CreateActor(const RayFunction &function, << "Actor " << actor_id << " already exists"; *return_actor_id = actor_id; TaskSpecification task_spec = builder.Build(); - RAY_LOG(DEBUG) << "Submit actor creation task " << task_spec.DebugString(); + RAY_LOG(DEBUG) << "Submitting actor creation task " << task_spec.DebugString(); if (options_.is_local_mode) { // TODO(suquark): Should we consider namespace in local mode? Currently // it looks like two actors with two different namespaces become the @@ -2127,7 +2127,7 @@ std::vector CoreWorker::SubmitActorTask( // Submit task. TaskSpecification task_spec = builder.Build(); - RAY_LOG(DEBUG) << "Submit actor task " << task_spec.DebugString(); + RAY_LOG(DEBUG) << "Submitting actor task " << task_spec.DebugString(); std::vector returned_refs; if (options_.is_local_mode) { returned_refs = ExecuteTaskLocalMode(task_spec, actor_id);