@@ -199,15 +199,16 @@ class TKqpRunner::TImpl {
199199 if (Options_.InFlightLimit && AsyncState_.InFlight >= Options_.InFlightLimit ) {
200200 AwaitInFlight_.WaitI (Mutex_);
201201 }
202-
203202 ui64 requestId = AsyncState_.OnStartRequest ();
203+ Cout << TStringBuilder () << CoutColors_.Cyan () << TInstant::Now ().ToIsoStringLocal () << " Request #" << requestId << " started. " << CoutColors_.Yellow () << AsyncState_.GetInfoString () << CoutColors_.Default () << " \n " ;
204+
204205 RunningQueries_[requestId] = YdbSetup_.QueryRequestAsync (query, action, traceId, nullptr ).Subscribe ([this , requestId](const NThreading::TFuture<NKqpRun::TQueryResult>& f) {
205206 TGuard<TMutex> lock (Mutex_);
206207
207208 auto response = f.GetValue ().Response ;
208209 AsyncState_.OnRequestFinished (response.IsSuccess ());
209210 if (response.IsSuccess ()) {
210- Cout << CoutColors_.Green () << TInstant::Now ().ToIsoStringLocal () << " Request #" << requestId << " completed. " << CoutColors_.Yellow () << AsyncState_.GetInfoString () << CoutColors_.Default () << " \n " ;
211+ Cout << CoutColors_.Green () << TInstant::Now ().ToIsoStringLocal () << " Request #" << requestId << " completed. " << CoutColors_.Yellow () << AsyncState_.GetInfoString () << CoutColors_.Default () << Endl ;
211212 } else {
212213 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 ();
213214 }
@@ -220,7 +221,6 @@ class TKqpRunner::TImpl {
220221 }
221222 RunningQueries_.erase (requestId);
222223 }).IgnoreResult ();
223- Cout << TStringBuilder () << CoutColors_.Cyan () << TInstant::Now ().ToIsoStringLocal () << " Request #" << requestId << " started. " << CoutColors_.Yellow () << AsyncState_.GetInfoString () << CoutColors_.Default () << " \n " ;
224224 }
225225
226226 void WaitAsyncQueries () {
@@ -263,12 +263,14 @@ class TKqpRunner::TImpl {
263263 }
264264
265265 void PrintScriptResults () const {
266- Cout << CoutColors_.Cyan () << " Writing script query results" << CoutColors_.Default () << Endl;
267- for (size_t i = 0 ; i < ResultSets_.size (); ++i) {
268- if (ResultSets_.size () > 1 ) {
269- *Options_.ResultOutput << CoutColors_.Cyan () << " Result set " << i + 1 << " :" << CoutColors_.Default () << Endl;
266+ if (Options_.ResultOutput ) {
267+ Cout << CoutColors_.Cyan () << " Writing script query results" << CoutColors_.Default () << Endl;
268+ for (size_t i = 0 ; i < ResultSets_.size (); ++i) {
269+ if (ResultSets_.size () > 1 ) {
270+ *Options_.ResultOutput << CoutColors_.Cyan () << " Result set " << i + 1 << " :" << CoutColors_.Default () << Endl;
271+ }
272+ PrintScriptResult (ResultSets_[i]);
270273 }
271- PrintScriptResult (ResultSets_[i]);
272274 }
273275 }
274276
0 commit comments