Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA committed Jun 11, 2024
1 parent 6f6984f commit ce10854
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ydb/tests/tools/kqprun/kqprun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class TMain : public TMainClassArgs {
.Handler1([this](const NLastGetopt::TOptsParser* option) {
if (const TString& port = option->CurVal()) {
RunnerOptions.YdbSettings.MonitoringEnabled = true;
RunnerOptions.YdbSettings.MonitoringPortOffset = FromString(port.c_str());
RunnerOptions.YdbSettings.MonitoringPortOffset = FromString(port);
}
});

Expand Down
18 changes: 10 additions & 8 deletions ydb/tests/tools/kqprun/src/kqp_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,16 @@ class TKqpRunner::TImpl {
if (Options_.InFlightLimit && AsyncState_.InFlight >= Options_.InFlightLimit) {
AwaitInFlight_.WaitI(Mutex_);
}

ui64 requestId = AsyncState_.OnStartRequest();
Cout << TStringBuilder() << CoutColors_.Cyan() << TInstant::Now().ToIsoStringLocal() << " Request #" << requestId << " started. " << CoutColors_.Yellow() << AsyncState_.GetInfoString() << CoutColors_.Default() << "\n";

RunningQueries_[requestId] = YdbSetup_.QueryRequestAsync(query, action, traceId, nullptr).Subscribe([this, requestId](const NThreading::TFuture<NKqpRun::TQueryResult>& f) {
TGuard<TMutex> lock(Mutex_);

auto response = f.GetValue().Response;
AsyncState_.OnRequestFinished(response.IsSuccess());
if (response.IsSuccess()) {
Cout << CoutColors_.Green() << TInstant::Now().ToIsoStringLocal() << " Request #" << requestId << " completed. " << CoutColors_.Yellow() << AsyncState_.GetInfoString() << CoutColors_.Default() << "\n";
Cout << CoutColors_.Green() << TInstant::Now().ToIsoStringLocal() << " Request #" << requestId << " completed. " << CoutColors_.Yellow() << AsyncState_.GetInfoString() << CoutColors_.Default() << Endl;
} else {
Cout << CoutColors_.Red() << TInstant::Now().ToIsoStringLocal() << " Request #" << requestId << " failed " << response.Status << ". " << CoutColors_.Yellow() << AsyncState_.GetInfoString() << "\n" << CoutColors_.Red() << "Issues:\n" << response.Issues.ToString() << CoutColors_.Default();
}
Expand All @@ -220,7 +221,6 @@ class TKqpRunner::TImpl {
}
RunningQueries_.erase(requestId);
}).IgnoreResult();
Cout << TStringBuilder() << CoutColors_.Cyan() << TInstant::Now().ToIsoStringLocal() << " Request #" << requestId << " started. " << CoutColors_.Yellow() << AsyncState_.GetInfoString() << CoutColors_.Default() << "\n";
}

void WaitAsyncQueries() {
Expand Down Expand Up @@ -263,12 +263,14 @@ class TKqpRunner::TImpl {
}

void PrintScriptResults() const {
Cout << CoutColors_.Cyan() << "Writing script query results" << CoutColors_.Default() << Endl;
for (size_t i = 0; i < ResultSets_.size(); ++i) {
if (ResultSets_.size() > 1) {
*Options_.ResultOutput << CoutColors_.Cyan() << "Result set " << i + 1 << ":" << CoutColors_.Default() << Endl;
if (Options_.ResultOutput) {
Cout << CoutColors_.Cyan() << "Writing script query results" << CoutColors_.Default() << Endl;
for (size_t i = 0; i < ResultSets_.size(); ++i) {
if (ResultSets_.size() > 1) {
*Options_.ResultOutput << CoutColors_.Cyan() << "Result set " << i + 1 << ":" << CoutColors_.Default() << Endl;
}
PrintScriptResult(ResultSets_[i]);
}
PrintScriptResult(ResultSets_[i]);
}
}

Expand Down

0 comments on commit ce10854

Please sign in to comment.