summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhcpp <[email protected]>2022-07-29 14:58:59 +0300
committerhcpp <[email protected]>2022-07-29 14:58:59 +0300
commit3b28eb328234433933b1471ccf35e7a8a1417bdd (patch)
treedf7061c72c8203fffe94d3b02ee7fee706b27951
parentc47ea27d22ee334dd949daf9bd7a39078639efdd (diff)
submitted_at implemetation
started_at after get task submitted at has been addedd
-rw-r--r--ydb/core/yq/libs/actors/run_actor.cpp17
-rw-r--r--ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp3
2 files changed, 12 insertions, 8 deletions
diff --git a/ydb/core/yq/libs/actors/run_actor.cpp b/ydb/core/yq/libs/actors/run_actor.cpp
index 1dcba28f7d1..4aebb2a8d82 100644
--- a/ydb/core/yq/libs/actors/run_actor.cpp
+++ b/ydb/core/yq/libs/actors/run_actor.cpp
@@ -303,6 +303,14 @@ public:
QueryCounters,
CreatedAt
));
+
+ if (!Params.RequestStartedAt) {
+ Params.RequestStartedAt = TInstant::Now();
+ Fq::Private::PingTaskRequest request;
+ *request.mutable_started_at() = google::protobuf::util::TimeUtil::MillisecondsToTimestamp(Params.RequestStartedAt.MilliSeconds());
+ Send(Pinger, new TEvents::TEvForwardPingRequest(request), 0, UpdateQueryInfoCookie);
+ }
+
Become(&TRunActor::StateFuncWrapper<&TRunActor::StateFunc>);
try {
@@ -400,11 +408,8 @@ private:
bool TimeLimitExceeded() {
if (Params.ExecutionTtl != TDuration::Zero()) {
auto currentTime = TInstant::Now();
- auto started_at = Params.RequestStartedAt;
- if (started_at == TInstant::Zero()) {
- started_at = currentTime;
- }
- auto deadline = started_at + Params.ExecutionTtl;
+ auto startedAt = Params.RequestStartedAt ? Params.RequestStartedAt : currentTime;
+ auto deadline = startedAt + Params.ExecutionTtl;
if (currentTime >= deadline) {
Abort("Execution time limit exceeded", YandexQuery::QueryMeta::ABORTED_BY_SYSTEM);
@@ -1084,7 +1089,6 @@ private:
void RunDqGraphs() {
if (DqGraphParams.empty()) {
- *QueryStateUpdateRequest.mutable_started_at() = google::protobuf::util::TimeUtil::MillisecondsToTimestamp(CreatedAt.MilliSeconds());
QueryStateUpdateRequest.set_resign_query(false);
const bool isOk = Issues.Size() == 0;
Finish(GetFinishStatus(isOk));
@@ -1095,7 +1099,6 @@ private:
Params.Status = YandexQuery::QueryMeta::RUNNING;
Fq::Private::PingTaskRequest request;
request.set_status(YandexQuery::QueryMeta::RUNNING);
- *request.mutable_started_at() = google::protobuf::util::TimeUtil::MillisecondsToTimestamp(Now().MilliSeconds());
Send(Pinger, new TEvents::TEvForwardPingRequest(request), 0, UpdateQueryInfoCookie);
}
diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp
index 97ef8b866e2..dec8d678b7a 100644
--- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp
+++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_queries.cpp
@@ -147,7 +147,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvCreateQuery
meta.set_last_job_query_revision(InitialRevision);
meta.set_last_job_id(jobId);
meta.set_started_by(user);
-
+ *meta.mutable_submitted_at() = NProtoInterop::CastToProto(startTime);
*job.mutable_meta() = common;
job.mutable_meta()->set_id(jobId);
job.set_text(content.text());
@@ -926,6 +926,7 @@ void TYdbControlPlaneStorageActor::Handle(TEvControlPlaneStorage::TEvModifyQuery
query.mutable_meta()->clear_expire_at();
query.mutable_meta()->clear_result_expire_at();
query.mutable_meta()->set_started_by(user);
+ *query.mutable_meta()->mutable_submitted_at() = NProtoInterop::CastToProto(now);
query.mutable_meta()->clear_action();
internal.clear_plan_compressed();