ExternalJobResultListener(AttemptId attemptId, UserResponseHandler connection, Job job, BufferAllocator allocator) { super(attemptId, job, allocator, NoOpJobStatusListener.INSTANCE); this.connection = connection; this.externalId = JobsServiceUtil.getJobIdAsExternalId(job.getJobId()); }
private QueryListener(Job job, UserResponseHandler connection) { this.job = job; externalId = JobsServiceUtil.getJobIdAsExternalId(job.getJobId()); this.responseHandler = Preconditions.checkNotNull(connection, "handler cannot be null"); this.statusListener = null; isInternal = false; setupJobData(); }
private QueryListener(Job job, JobStatusListener statusListener) { this.job = job; externalId = JobsServiceUtil.getJobIdAsExternalId(job.getJobId()); this.responseHandler = null; this.statusListener = Preconditions.checkNotNull(statusListener, "statusListener cannot be null"); isInternal = true; setupJobData(); }
@Override public QueryProfile getProfile(JobId jobId, int attempt) throws JobNotFoundException { Job job = getJob(jobId); final AttemptId attemptId = new AttemptId(JobsServiceUtil.getJobIdAsExternalId(jobId), attempt); if(jobIsDone(job.getJobAttempt())){ return profileStore.get(attemptId); } // Check if the profile for given attempt already exists. Even if the job is not done, it is possible that // profile exists for previous attempts final QueryProfile queryProfile = profileStore.get(attemptId); if (queryProfile != null) { return queryProfile; } final NodeEndpoint endpoint = job.getJobAttempt().getEndpoint(); if(endpoint.equals(identity)){ final ForemenTool tool = this.foremenTool.get(); Optional<QueryProfile> profile = tool.getProfile(attemptId.getExternalId()); return profile.orNull(); } try{ CoordTunnel tunnel = coordTunnelCreator.get().getTunnel(JobsServiceUtil.toPB(endpoint)); return tunnel.requestQueryProfile(attemptId.getExternalId()).checkedGet(15, TimeUnit.SECONDS); }catch(TimeoutException | RpcException | RuntimeException e){ logger.info("Unable to retrieve remote query profile for external id: {}", ExternalIdHelper.toString(attemptId.getExternalId()), e); return null; } }