@Override public void write(DataOutput out) throws IOException { out.writeLong(fakeAppId.getClusterTimestamp()); out.writeInt(fakeAppId.getId()); token.write(out); out.writeLong(creationTime); out.writeInt(vertexParallelism); if (vertexSpec != null) { out.writeInt(vertexSpec.length); out.write(vertexSpec); } else { out.writeInt(0); } if (vertexSpecSignature != null) { out.writeInt(vertexSpecSignature.length); out.write(vertexSpecSignature); } else { out.writeInt(0); } }
private void setupMRLegacyConfigs(ProcessorContext processorContext) { // Hive "insert overwrite local directory" uses task id as dir name // Setting the id in jobconf helps to have the similar dir name as MR StringBuilder taskAttemptIdBuilder = new StringBuilder("attempt_"); taskAttemptIdBuilder.append(processorContext.getApplicationId().getClusterTimestamp()) .append("_") .append(jobIdFormat.format(processorContext.getApplicationId().getId())) .append("_"); if (isMap) { taskAttemptIdBuilder.append("m_"); } else { taskAttemptIdBuilder.append("r_"); } taskAttemptIdBuilder.append(taskIdFormat.format(processorContext.getTaskIndex())) .append("_") .append(processorContext.getTaskAttemptNumber()); // In MR, mapreduce.task.attempt.id is same as mapred.task.id. Go figure. String taskAttemptIdStr = taskAttemptIdBuilder.toString(); this.jobConf.set("mapred.task.id", taskAttemptIdStr); this.jobConf.set("mapreduce.task.attempt.id", taskAttemptIdStr); this.jobConf.setInt("mapred.task.partition", processorContext.getTaskIndex()); }
private void setupMRLegacyConfigs(ProcessorContext processorContext) { // Hive "insert overwrite local directory" uses task id as dir name // Setting the id in jobconf helps to have the similar dir name as MR StringBuilder taskAttemptIdBuilder = new StringBuilder("attempt_"); taskAttemptIdBuilder.append(processorContext.getApplicationId().getClusterTimestamp()) .append("_") .append(jobIdFormat.format(processorContext.getApplicationId().getId())) .append("_"); if (isMap) { taskAttemptIdBuilder.append("m_"); } else { taskAttemptIdBuilder.append("r_"); } taskAttemptIdBuilder.append(taskIdFormat.format(processorContext.getTaskIndex())) .append("_") .append(processorContext.getTaskAttemptNumber()); // In MR, mapreduce.task.attempt.id is same as mapred.task.id. Go figure. String taskAttemptIdStr = taskAttemptIdBuilder.toString(); this.jobConf.set("mapred.task.id", taskAttemptIdStr); this.jobConf.set("mapreduce.task.attempt.id", taskAttemptIdStr); this.jobConf.setInt("mapred.task.partition", processorContext.getTaskIndex()); }
public ContainerFactory(ApplicationAttemptId appAttemptId, long appIdLong) { this.nextId = new AtomicLong(1); ApplicationId appId = ApplicationId.newInstance(appIdLong, appAttemptId.getApplicationId().getId()); this.customAppAttemptId = ApplicationAttemptId.newInstance(appId, appAttemptId.getAttemptId()); }
+ jstormMasterContext.appAttemptID.getApplicationId().getId() + ", clustertimestamp=" + jstormMasterContext.appAttemptID.getApplicationId().getClusterTimestamp() + ", attemptId=" + jstormMasterContext.appAttemptID.getAttemptId());
+ applicationAttemptID.getApplicationId().getId() + ", clustertimestamp=" + applicationAttemptID.getApplicationId().getClusterTimestamp()
+ ", appId=" + appId.getId() + ", clientToAMToken=" + report.getClientToAMToken() + ", appDiagnostics=" + report.getDiagnostics()
+ appAttemptID.getApplicationId().getId() + ", clustertimestamp=" + appAttemptID.getApplicationId().getClusterTimestamp() + ", attemptId=" + appAttemptID.getAttemptId());
+ ", appId=" + appId.getId() + ", clientToAMToken=" + report.getClientToAMToken() + ", appDiagnostics=" + report.getDiagnostics()
public static String generateDefaultFlowName(String appName, ApplicationId appId) { return (appName != null && !appName.equals(YarnConfiguration.DEFAULT_APPLICATION_NAME)) ? appName : "flow_" + appId.getClusterTimestamp() + "_" + appId.getId(); }
@Override public int hashCode() { // Generated by eclipse. final int prime = 371237; int result = 6521; long clusterTimestamp = getClusterTimestamp(); result = prime * result + (int) (clusterTimestamp ^ (clusterTimestamp >>> 32)); result = prime * result + getId(); return result; }
@Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(APPLICATION_ID_PREFIX); sb.append(getClusterTimestamp()); sb.append('_'); FastNumberFormat.format(sb, getId(), APP_ID_MIN_DIGITS); return sb.toString(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(TIMELINE_ENTITY_GROUPID_STR_PREFIX + "_"); ApplicationId appId = getApplicationId(); sb.append(appId.getClusterTimestamp()).append("_"); sb.append(appId.getId()).append("_"); sb.append(getTimelineEntityGroupId()); return sb.toString(); }
@Override public String toString() { StringBuilder builder = new StringBuilder(TASK); JobId jobId = getJobId(); builder.append("_").append(jobId.getAppId().getClusterTimestamp()); builder.append("_").append( JobId.jobIdFormat.get().format(jobId.getAppId().getId())); builder.append("_"); builder.append(getTaskType() == TaskType.MAP ? "m" : "r").append("_"); builder.append(taskIdFormat.get().format(getId())); return builder.toString(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append(APP_ATTEMPT_ID_PREFIX); ApplicationId appId = getApplicationId(); sb.append(appId.getClusterTimestamp()); sb.append('_'); FastNumberFormat.format(sb, appId.getId(), APP_ID_MIN_DIGITS); sb.append('_'); FastNumberFormat.format(sb, getAttemptId(), ATTEMPT_ID_MIN_DIGITS); return sb.toString(); }
@Override public void stopApplication(ApplicationTerminationContext context) { ApplicationId appId = context.getApplicationId(); JobID jobId = new JobID(Long.toString(appId.getClusterTimestamp()), appId.getId()); try { removeJobShuffleInfo(jobId); } catch (IOException e) { LOG.error("Error during stopApp", e); // TODO add API to AuxiliaryServices to report failures } }
@Override public int compareTo(ApplicationId other) { if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) { return this.getId() - other.getId(); } else { return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1 : this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0; } }
public LocalContainerFactory(ApplicationAttemptId appAttemptId, long customAppId) { this.nextId = new AtomicInteger(1); ApplicationId appId = ApplicationId .newInstance(customAppId, appAttemptId.getApplicationId().getId()); this.customAppAttemptId = ApplicationAttemptId .newInstance(appId, appAttemptId.getAttemptId()); }
@Override public GetTimelineCollectorContextResponse getTimelineCollectorContext( GetTimelineCollectorContextRequest request) throws YarnException, IOException { if (request.getApplicationId().getId() == 1) { return GetTimelineCollectorContextResponse.newInstance( "test_user_id", "test_flow_name", "test_flow_version", 12345678L); } else { throw new YarnException("The application is not found."); } } }
@Test public void testGetNewAppId() throws Exception { Logger rootLogger = LogManager.getRootLogger(); rootLogger.setLevel(Level.DEBUG); MockRM rm = new MockRM(conf); rm.start(); GetNewApplicationResponse resp = rm.getNewAppId(); assert (resp.getApplicationId().getId() != 0); assert (resp.getMaximumResourceCapability().getMemorySize() > 0); rm.stop(); }