| 120 | } |
| 121 | |
| 122 | bool LaunchJobRequest(TJobRequest* jr, TRemoteQueryProcessor* queryProc, IUserContext* userContext, IMRCommandCompleteNotify* mrNotify) { |
| 123 | Y_ASSERT(queryProc); |
| 124 | Y_ASSERT(!jr->HostId2Computer.empty()); |
| 125 | int hostIdCount = jr->HostId2Computer.ysize(); |
| 126 | int localCompId = queryProc->GetCompId(); |
| 127 | |
| 128 | THashMap<int, bool> allHostIdSet; |
| 129 | bool hasAllHostIds = true; |
| 130 | for (int i = 0; i < hostIdCount; ++i) { |
| 131 | allHostIdSet[i]; |
| 132 | hasAllHostIds &= !jr->HostId2Computer[i].empty(); |
| 133 | } |
| 134 | |
| 135 | if (hasAllHostIds) { |
| 136 | // has at least one remote comp for each hostId |
| 137 | // try regular execution |
| 138 | bool chk = ScheduleJobRequest(jr, queryProc); |
| 139 | Y_ABORT_UNLESS(chk); |
| 140 | |
| 141 | TMRCommandExec::Launch(jr, queryProc, localCompId, userContext, mrNotify); |
| 142 | } else { |
| 143 | // not all hostIds are ready |
| 144 | // lets check if we can execute locally |
| 145 | if (!userContext->HasHostIds(allHostIdSet)) { |
| 146 | // can not execute locally |
| 147 | return false; |
| 148 | } |
| 149 | LaunchLocalJobRequest(jr, localCompId, userContext, mrNotify); |
| 150 | } |
| 151 | return true; |
| 152 | } |
| 153 | } |
no test coverage detected