@Test public void testResourceSchedulingInProfile() throws Exception { AttemptObservers observers = AttemptObservers.of(observer); final NodeEndpoint endpoint = NodeEndpoint.newBuilder().setAddress("host1").setFabricPort(12345).build(); when(context.getCurrentEndpoint()).thenReturn(endpoint); QueryManager queryManager = new QueryManager(queryId, context, null, completionListener, new Pointer<>(), observers, true, true, catalog); ResourceSchedulingDecisionInfo result = new ResourceSchedulingDecisionInfo(); result.setQueueId("abcd"); result.setQueueName("queue.abcd"); observers.resourcesScheduled(result); UserBitShared.QueryProfile queryProfile = queryManager.getQueryProfile("my description", UserBitShared.QueryResult.QueryState.RUNNING, null, "some reason"); assertNotNull(queryProfile.getResourceSchedulingProfile()); assertEquals("abcd", queryProfile.getResourceSchedulingProfile().getQueueId()); assertEquals("queue.abcd", queryProfile.getResourceSchedulingProfile().getQueueName()); } }
/** * @return Get query planning time. If the planning hasn't started, returns "Planning not started". If planning hasn't * completed, returns "Still planning". */ @SuppressWarnings("unused") public String getPlanningTime() { final QueryProfile profile = getProfile(); if (!profile.hasPlanningStart() || profile.getPlanningStart() == 0) { return "Planning not started"; } if (!profile.hasPlanningEnd() || profile.getPlanningEnd() == 0) { return "Still planning"; } // Starting from 3.0, the planning time includes the resource queueing time. Thus, correcting for it when resource scheduling time exists long planningPlusSchedulingTime = profile.getPlanningEnd() - profile.getPlanningStart(); UserBitShared.ResourceSchedulingProfile r = profile.getResourceSchedulingProfile(); if (r == null || r.getResourceSchedulingStart() == 0 || r.getResourceSchedulingEnd() == 0) { return NUMBER_FORMAT.format(planningPlusSchedulingTime) + "ms"; } long schedulingTime = r.getResourceSchedulingEnd() - r.getResourceSchedulingStart(); return NUMBER_FORMAT.format(planningPlusSchedulingTime - schedulingTime) + "ms"; }
public Builder mergeFrom(com.dremio.exec.proto.UserBitShared.ResourceSchedulingProfile other) { if (other == com.dremio.exec.proto.UserBitShared.ResourceSchedulingProfile.getDefaultInstance()) return this; if (other.hasQueueName()) { bitField0_ |= 0x00000001; queueName_ = other.queueName_; onChanged(); if (other.hasQueueId()) { bitField0_ |= 0x00000002; queueId_ = other.queueId_; onChanged(); if (other.hasRuleContent()) { bitField0_ |= 0x00000004; ruleContent_ = other.ruleContent_; onChanged(); if (other.hasRuleId()) { bitField0_ |= 0x00000008; ruleId_ = other.ruleId_; onChanged(); if (other.hasRuleName()) { bitField0_ |= 0x00000010; ruleName_ = other.ruleName_; onChanged(); if (other.hasRuleAction()) { bitField0_ |= 0x00000020; ruleAction_ = other.ruleAction_;
jobInfo.setResourceSchedulingInfo(new ResourceSchedulingInfo()); jobInfo.getResourceSchedulingInfo().setQueueName(profile.getResourceSchedulingProfile().getQueueName()); jobInfo.getResourceSchedulingInfo().setQueueId(profile.getResourceSchedulingProfile().getQueueId());
if (r.hasQueueName()) { dlb.addItem("Queue Name:", r.getQueueName()); if (r.hasQueueId()) { dlb.addItem("Queue Id:", r.getQueueId()); if (r.hasRuleName()) { dlb.addItem("Rule Name:", r.getRuleName()); if (r.hasRuleId()) { dlb.addItem("Rule Id:", r.getRuleId()); if (r.hasRuleContent()) { dlb.addItem("Rule Content:", r.getRuleContent()); if (r.hasRuleAction()) { dlb.addItem("Rule Action:", r.getRuleAction()); if (r.hasSchedulingProperties()) { UserBitShared.ResourceSchedulingProperties rsp = r.getSchedulingProperties(); if (rsp.hasQueryCost()) { dlb.addItem("Query Cost:", String.format("%.0f", rsp.getQueryCost()));
@Override public void execStarted(QueryProfile profile) { try (TimedBlock b = Timer.time("execStarted")) { b.addID("attempt=" + attemptId); final JobInfo jobInfo = job.getJobAttempt().getInfo(); if(profile != null){ jobInfo.setStartTime(profile.getStart()); job.getJobAttempt().setState(JobState.RUNNING); final QueryProfileParser profileParser = new QueryProfileParser(jobId, profile); if (profile.getResourceSchedulingProfile() != null) { if (jobInfo.getResourceSchedulingInfo() == null) { jobInfo.setResourceSchedulingInfo(new ResourceSchedulingInfo()); } jobInfo.getResourceSchedulingInfo().setQueueName(profile.getResourceSchedulingProfile().getQueueName()); jobInfo.getResourceSchedulingInfo().setQueueId(profile.getResourceSchedulingProfile().getQueueId()); } job.getJobAttempt().setStats(profileParser.getJobStats()); job.getJobAttempt().setDetails(profileParser.getJobDetails()); storeJob(job); if (externalListenerManager != null) { externalListenerManager.queryUpdate(job); } } } catch (IOException e) { exception.addException(e); } }
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.UserBitShared.ResourceSchedulingProfile message) throws java.io.IOException { if(message.hasQueueName()) output.writeString(1, message.getQueueName(), false); if(message.hasQueueId()) output.writeString(2, message.getQueueId(), false); if(message.hasRuleContent()) output.writeString(3, message.getRuleContent(), false); if(message.hasRuleId()) output.writeString(4, message.getRuleId(), false); if(message.hasRuleName()) output.writeString(5, message.getRuleName(), false); if(message.hasRuleAction()) output.writeString(6, message.getRuleAction(), false); if(message.hasSchedulingProperties()) output.writeObject(7, message.getSchedulingProperties(), com.dremio.exec.proto.SchemaUserBitShared.ResourceSchedulingProperties.WRITE, false); if(message.hasResourceSchedulingStart()) output.writeInt64(8, message.getResourceSchedulingStart(), false); if(message.hasResourceSchedulingEnd()) output.writeInt64(9, message.getResourceSchedulingEnd(), false); } public boolean isInitialized(com.dremio.exec.proto.UserBitShared.ResourceSchedulingProfile message)
/** * <code>optional string queue_name = 1;</code> */ public Builder clearQueueName() { bitField0_ = (bitField0_ & ~0x00000001); queueName_ = getDefaultInstance().getQueueName(); onChanged(); return this; } /**
/** * <code>optional string rule_content = 3;</code> */ public Builder clearRuleContent() { bitField0_ = (bitField0_ & ~0x00000004); ruleContent_ = getDefaultInstance().getRuleContent(); onChanged(); return this; } /**
/** * <code>optional string rule_action = 6;</code> */ public Builder clearRuleAction() { bitField0_ = (bitField0_ & ~0x00000020); ruleAction_ = getDefaultInstance().getRuleAction(); onChanged(); return this; } /**
/** * <code>optional string rule_name = 5;</code> */ public Builder clearRuleName() { bitField0_ = (bitField0_ & ~0x00000010); ruleName_ = getDefaultInstance().getRuleName(); onChanged(); return this; } /**
/** * <code>optional string rule_id = 4;</code> */ public Builder clearRuleId() { bitField0_ = (bitField0_ & ~0x00000008); ruleId_ = getDefaultInstance().getRuleId(); onChanged(); return this; } /**
/** * <code>optional string queue_id = 2;</code> */ public Builder clearQueueId() { bitField0_ = (bitField0_ & ~0x00000002); queueId_ = getDefaultInstance().getQueueId(); onChanged(); return this; } /**
@SuppressWarnings("unused") public String getQueueTime() { UserBitShared.ResourceSchedulingProfile r = profile.getResourceSchedulingProfile(); if (r == null || r.getResourceSchedulingStart() == 0 || r.getResourceSchedulingEnd() == 0) { return ""; } return NUMBER_FORMAT.format(r.getResourceSchedulingEnd() - r.getResourceSchedulingStart()) + "ms"; }