@@ -195,6 +195,26 @@ class TKqpNodeService : public TActorBootstrapped<TKqpNodeService> {
195195
196196 auto schedulerNow = TlsActivationContext->Monotonic ();
197197
198+ TString schedulerGroup = msg.GetSchedulerGroup ();
199+
200+ if (SchedulerOptions.Scheduler ->Disabled (schedulerGroup)) {
201+ auto share = msg.GetPoolMaxCpuShare ();
202+ if (share <= 0 && msg.HasQueryCpuShare ()) {
203+ share = 1.0 ;
204+ }
205+ if (share > 0 ) {
206+ Scheduler->UpdateGroupShare (schedulerGroup, share, schedulerNow);
207+ Send (SchedulerActorId, new TEvSchedulerNewPool (msg.GetDatabase (), schedulerGroup));
208+ } else {
209+ schedulerGroup = " " ;
210+ }
211+ }
212+
213+ std::optional<ui64> querySchedulerGroup;
214+ if (msg.HasQueryCpuShare () && schedulerGroup) {
215+ querySchedulerGroup = Scheduler->MakePerQueryGroup (schedulerNow, msg.GetQueryCpuShare (), schedulerGroup);
216+ }
217+
198218 // start compute actors
199219 TMaybe<NYql::NDqProto::TRlPath> rlPath = Nothing ();
200220 if (msgRtSettings.HasRlPath ()) {
@@ -208,30 +228,21 @@ class TKqpNodeService : public TActorBootstrapped<TKqpNodeService> {
208228
209229 const ui32 tasksCount = msg.GetTasks ().size ();
210230 for (auto & dqTask: *msg.MutableTasks ()) {
211- TString group = msg.GetSchedulerGroup ();
212-
213231 TComputeActorSchedulingOptions schedulingTaskOptions {
214232 .Now = schedulerNow,
215233 .SchedulerActorId = SchedulerActorId,
216234 .Scheduler = Scheduler.get (),
217- .Group = group ,
235+ .Group = schedulerGroup ,
218236 .Weight = 1 ,
219- .NoThrottle = false ,
237+ .NoThrottle = schedulerGroup. empty () ,
220238 .Counters = Counters
221239 };
222240
223- if (SchedulerOptions.Scheduler ->Disabled (group)) {
224- auto share = msg.GetMaxCpuShare ();
225- if (share > 0 ) {
226- Scheduler->UpdateMaxShare (group, share, schedulerNow);
227- Send (SchedulerActorId, new TEvSchedulerNewPool (msg.GetDatabase (), group, share));
228- } else {
229- schedulingTaskOptions.NoThrottle = true ;
230- }
231- }
232-
233241 if (!schedulingTaskOptions.NoThrottle ) {
234242 schedulingTaskOptions.Handle = SchedulerOptions.Scheduler ->Enroll (schedulingTaskOptions.Group , schedulingTaskOptions.Weight , schedulingTaskOptions.Now );
243+ if (querySchedulerGroup) {
244+ Scheduler->AddToGroup (schedulerNow, *querySchedulerGroup, schedulingTaskOptions.Handle );
245+ }
235246 }
236247
237248 auto result = CaFactory_->CreateKqpComputeActor ({
0 commit comments