diff options
author | Tagir Khamitov <tagir200917@gmail.com> | 2024-06-15 17:40:00 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-06-15 17:49:45 +0300 |
commit | b3ca01f0fd071e6769a1da056e6608147ec6cfb0 (patch) | |
tree | c2476028f2ca011cf2b9c55e4a41d5881fc7eec0 /yt | |
parent | cbd5243d6cb5a29e001b1d67ff44e182d2ed561e (diff) | |
download | ydb-b3ca01f0fd071e6769a1da056e6608147ec6cfb0.tar.gz |
Implemented RPC method for reading JobProxy logs
As a part of working on [this issue](https://github.com/ytsaurus/ytsaurus/issues/165) I've implemented RPC method for reading JobProxy logs and uploading them to Cypress.
---
f31ec2651b37b87791e950e7ad7264f6f8ece645
Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/594
Co-authored-by: ignat <ignat@yandex-team.com>
Diffstat (limited to 'yt')
-rw-r--r-- | yt/yt/client/api/delegating_client.h | 7 | ||||
-rw-r--r-- | yt/yt/client/api/operation_client.h | 10 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/api_service_proxy.h | 1 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.cpp | 18 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/client_impl.h | 6 | ||||
-rw-r--r-- | yt/yt/client/driver/driver.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/driver/scheduler_commands.cpp | 19 | ||||
-rw-r--r-- | yt/yt/client/driver/scheduler_commands.h | 18 | ||||
-rw-r--r-- | yt/yt/client/federated/client.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/hedging/hedging.cpp | 1 | ||||
-rw-r--r-- | yt/yt/client/unittests/mock/client.h | 7 | ||||
-rw-r--r-- | yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto | 13 |
12 files changed, 102 insertions, 0 deletions
diff --git a/yt/yt/client/api/delegating_client.h b/yt/yt/client/api/delegating_client.h index 2889cb27af..09ede07c6a 100644 --- a/yt/yt/client/api/delegating_client.h +++ b/yt/yt/client/api/delegating_client.h @@ -555,6 +555,13 @@ public: const TAbortJobOptions& options), (jobId, options)) + DELEGATE_METHOD(TFuture<void>, DumpJobProxyLog, ( + NJobTrackerClient::TJobId jobId, + NJobTrackerClient::TOperationId operationId, + const NYPath::TYPath& path, + const TDumpJobProxyLogOptions& options), + (jobId, operationId, path, options)) + // Metadata DELEGATE_METHOD(TFuture<TClusterMeta>, GetClusterMeta, ( const TGetClusterMetaOptions& options), diff --git a/yt/yt/client/api/operation_client.h b/yt/yt/client/api/operation_client.h index d330727320..fa2095cc02 100644 --- a/yt/yt/client/api/operation_client.h +++ b/yt/yt/client/api/operation_client.h @@ -219,6 +219,10 @@ struct TAbortJobOptions std::optional<TDuration> InterruptTimeout; }; +struct TDumpJobProxyLogOptions + : public TTimeoutOptions +{ }; + struct TGetOperationOptions : public TTimeoutOptions , public TMasterReadOptions @@ -443,6 +447,12 @@ struct IOperationClient virtual TFuture<void> AbortJob( NJobTrackerClient::TJobId jobId, const TAbortJobOptions& options = {}) = 0; + + virtual TFuture<void> DumpJobProxyLog( + NJobTrackerClient::TJobId jobId, + NJobTrackerClient::TOperationId operationId, + const NYPath::TYPath& path, + const TDumpJobProxyLogOptions& options = {}) = 0; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/api/rpc_proxy/api_service_proxy.h b/yt/yt/client/api/rpc_proxy/api_service_proxy.h index 0f3f9f0454..c40e855363 100644 --- a/yt/yt/client/api/rpc_proxy/api_service_proxy.h +++ b/yt/yt/client/api/rpc_proxy/api_service_proxy.h @@ -123,6 +123,7 @@ public: DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, AbandonJob); DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, PollJobShell); DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, AbortJob); + DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, DumpJobProxyLog); // Files DEFINE_RPC_PROXY_METHOD(NRpcProxy::NProto, ReadFile, diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp index d83f53e37a..61d4404260 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.cpp +++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp @@ -1513,6 +1513,24 @@ TFuture<void> TClient::AbortJob( return req->Invoke().As<void>(); } +TFuture<void> TClient::DumpJobProxyLog( + NJobTrackerClient::TJobId jobId, + NJobTrackerClient::TOperationId operationId, + const NYPath::TYPath& path, + const TDumpJobProxyLogOptions& options) +{ + auto proxy = CreateApiServiceProxy(); + + auto req = proxy.DumpJobProxyLog(); + SetTimeoutOptions(*req, options); + + ToProto(req->mutable_job_id(), jobId); + ToProto(req->mutable_operation_id(), operationId); + ToProto(req->mutable_path(), path); + + return req->Invoke().As<void>(); +} + TFuture<TGetFileFromCacheResult> TClient::GetFileFromCache( const TString& md5, const TGetFileFromCacheOptions& options) diff --git a/yt/yt/client/api/rpc_proxy/client_impl.h b/yt/yt/client/api/rpc_proxy/client_impl.h index db4ff7d8a9..9c336728b8 100644 --- a/yt/yt/client/api/rpc_proxy/client_impl.h +++ b/yt/yt/client/api/rpc_proxy/client_impl.h @@ -305,6 +305,12 @@ public: NJobTrackerClient::TJobId jobId, const NApi::TAbortJobOptions& options) override; + TFuture<void> DumpJobProxyLog( + NJobTrackerClient::TJobId jobId, + NJobTrackerClient::TOperationId operationId, + const NYPath::TYPath& path, + const NApi::TDumpJobProxyLogOptions& options) override; + // Metadata. TFuture<NApi::TClusterMeta> GetClusterMeta( const NApi::TGetClusterMetaOptions&) override; diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp index 0d6488193f..4853e6b65e 100644 --- a/yt/yt/client/driver/driver.cpp +++ b/yt/yt/client/driver/driver.cpp @@ -306,6 +306,7 @@ public: REGISTER (TDumpJobContextCommand, "dump_job_context", Null, Structured, true, false, ApiVersion4); REGISTER (TAbandonJobCommand, "abandon_job", Null, Structured, true, false, ApiVersion4); REGISTER (TAbortJobCommand, "abort_job", Null, Structured, true, false, ApiVersion4); + REGISTER (TDumpJobProxyLogCommand, "dump_job_proxy_log", Null, Structured, true, false, ApiVersion4); REGISTER_ALL(TGetVersionCommand, "get_version", Null, Structured, false, false); REGISTER_ALL(TGetSupportedFeaturesCommand, "get_supported_features", Null, Structured, false, false); diff --git a/yt/yt/client/driver/scheduler_commands.cpp b/yt/yt/client/driver/scheduler_commands.cpp index 782e923abe..ce7e07d67c 100644 --- a/yt/yt/client/driver/scheduler_commands.cpp +++ b/yt/yt/client/driver/scheduler_commands.cpp @@ -629,6 +629,25 @@ void TAbortJobCommand::DoExecute(ICommandContextPtr context) //////////////////////////////////////////////////////////////////////////////// +void TDumpJobProxyLogCommand::Register(TRegistrar registrar) +{ + registrar.Parameter("job_id", &TThis::JobId); + + registrar.Parameter("operation_id", &TThis::OperationId); + + registrar.Parameter("path", &TThis::Path); +} + +void TDumpJobProxyLogCommand::DoExecute(ICommandContextPtr context) +{ + WaitFor(context->GetClient()->DumpJobProxyLog(JobId, OperationId, Path)) + .ThrowOnError(); + + ProduceEmptyOutput(context); +} + +//////////////////////////////////////////////////////////////////////////////// + void TStartOperationCommand::Register(TRegistrar registrar) { registrar.BaseClassParameter("operation_type", &TThis::OperationType); diff --git a/yt/yt/client/driver/scheduler_commands.h b/yt/yt/client/driver/scheduler_commands.h index b0daea15fb..5b29f94ce5 100644 --- a/yt/yt/client/driver/scheduler_commands.h +++ b/yt/yt/client/driver/scheduler_commands.h @@ -250,6 +250,24 @@ public: //////////////////////////////////////////////////////////////////////////////// +class TDumpJobProxyLogCommand + : public TTypedCommand<NApi::TDumpJobProxyLogOptions> +{ +private: + NJobTrackerClient::TJobId JobId; + NJobTrackerClient::TOperationId OperationId; + NYPath::TYPath Path; + +public: + REGISTER_YSON_STRUCT_LITE(TDumpJobProxyLogCommand); + + static void Register(TRegistrar registrar); + + void DoExecute(ICommandContextPtr context) override; +}; + +//////////////////////////////////////////////////////////////////////////////// + class TStartOperationCommandBase : public TTypedCommand<NApi::TStartOperationOptions> { diff --git a/yt/yt/client/federated/client.cpp b/yt/yt/client/federated/client.cpp index 5e6447f3c3..4f60ac5e0b 100644 --- a/yt/yt/client/federated/client.cpp +++ b/yt/yt/client/federated/client.cpp @@ -394,6 +394,7 @@ public: UNIMPLEMENTED_METHOD(TFuture<void>, AbandonJob, (NJobTrackerClient::TJobId, const TAbandonJobOptions&)); UNIMPLEMENTED_METHOD(TFuture<TPollJobShellResponse>, PollJobShell, (NJobTrackerClient::TJobId, const std::optional<TString>&, const NYson::TYsonString&, const TPollJobShellOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, AbortJob, (NJobTrackerClient::TJobId, const TAbortJobOptions&)); + UNIMPLEMENTED_METHOD(TFuture<void>, DumpJobProxyLog, (NJobTrackerClient::TJobId, NJobTrackerClient::TOperationId, const NYPath::TYPath&, const TDumpJobProxyLogOptions&)); UNIMPLEMENTED_METHOD(TFuture<TClusterMeta>, GetClusterMeta, (const TGetClusterMetaOptions&)); UNIMPLEMENTED_METHOD(TFuture<void>, CheckClusterLiveness, (const TCheckClusterLivenessOptions&)); UNIMPLEMENTED_METHOD(TFuture<int>, BuildSnapshot, (const TBuildSnapshotOptions&)); diff --git a/yt/yt/client/hedging/hedging.cpp b/yt/yt/client/hedging/hedging.cpp index 10833b8f92..fa64da3a74 100644 --- a/yt/yt/client/hedging/hedging.cpp +++ b/yt/yt/client/hedging/hedging.cpp @@ -172,6 +172,7 @@ public: UNSUPPORTED_METHOD(TFuture<void>, AbandonJob, (NJobTrackerClient::TJobId, const TAbandonJobOptions&)); UNSUPPORTED_METHOD(TFuture<TPollJobShellResponse>, PollJobShell, (NJobTrackerClient::TJobId, const std::optional<TString>&, const NYson::TYsonString&, const TPollJobShellOptions&)); UNSUPPORTED_METHOD(TFuture<void>, AbortJob, (NJobTrackerClient::TJobId, const TAbortJobOptions&)); + UNSUPPORTED_METHOD(TFuture<void>, DumpJobProxyLog, (NJobTrackerClient::TJobId, NJobTrackerClient::TOperationId, const NYPath::TYPath&, const TDumpJobProxyLogOptions&)); UNSUPPORTED_METHOD(TFuture<TClusterMeta>, GetClusterMeta, (const TGetClusterMetaOptions&)); UNSUPPORTED_METHOD(TFuture<void>, CheckClusterLiveness, (const TCheckClusterLivenessOptions&)); UNSUPPORTED_METHOD(TFuture<int>, BuildSnapshot, (const TBuildSnapshotOptions&)); diff --git a/yt/yt/client/unittests/mock/client.h b/yt/yt/client/unittests/mock/client.h index 25e46ade40..8c1403d790 100644 --- a/yt/yt/client/unittests/mock/client.h +++ b/yt/yt/client/unittests/mock/client.h @@ -664,6 +664,13 @@ public: const TAbortJobOptions& options), (override)); + MOCK_METHOD(TFuture<void>, DumpJobProxyLog, ( + NJobTrackerClient::TJobId jobId, + NJobTrackerClient::TOperationId operationId, + const NYPath::TYPath& path, + const TDumpJobProxyLogOptions& options), + (override)); + MOCK_METHOD(TFuture<TClusterMeta>, GetClusterMeta, ( const TGetClusterMetaOptions& options), (override)); diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto index 929bf21229..24995c479b 100644 --- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto +++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto @@ -2527,6 +2527,19 @@ message TRspAbortJob } //////////////////////////////////////////////////////////////////////////////// + +message TReqDumpJobProxyLog +{ + required NYT.NProto.TGuid job_id = 1; + required NYT.NProto.TGuid operation_id = 2; + required string path = 3; // YPath +} + +message TRspDumpJobProxyLog +{ +} + +//////////////////////////////////////////////////////////////////////////////// // STREAMING //////////////////////////////////////////////////////////////////////////////// |