public FlowRunEntity(TimelineEntity entity) { super(entity); if (!entity.getType().equals( TimelineEntityType.YARN_FLOW_RUN.toString())) { throw new IllegalArgumentException("Incompatible entity type: " + getId()); } // set config to null setConfigs(null); }
@XmlElement(name = "id") @Override public String getId() { //Flow id schema: user@flow_name(or id)/run_id String id = super.getId(); if (id == null) { StringBuilder sb = new StringBuilder(); sb.append(getInfo().get(USER_INFO_KEY).toString()); sb.append('@'); sb.append(getInfo().get(FLOW_NAME_INFO_KEY).toString()); sb.append('/'); sb.append(getInfo().get(FLOW_RUN_ID_INFO_KEY).toString()); id = sb.toString(); setId(id); } return id; }
@Override protected TimelineEntity parseEntity(Result result) throws IOException { FlowRunEntity flowRun = new FlowRunEntity(); FlowRunRowKey rowKey = FlowRunRowKey.parseRowKey(result.getRow()); flowRun.setRunId(rowKey.getFlowRunId()); flowRun.setUser(rowKey.getUserId()); flowRun.setName(rowKey.getFlowName()); FlowRunColumn.MIN_START_TIME); if (startTime != null) { flowRun.setStartTime(startTime.longValue()); FlowRunColumn.MAX_END_TIME); if (endTime != null) { flowRun.setMaxEndTime(endTime.longValue()); FlowRunColumn.FLOW_VERSION); if (version != null) { flowRun.setVersion(version); flowRun.setId(flowRun.getId()); flowRun.getInfo().put(TimelineReaderUtils.FROMID_KEY, rowKey.getRowKeyAsString()); return flowRun;
Long runId = e.getKey(); String version = (String)e.getValue(); FlowRunEntity flowRun = new FlowRunEntity(); flowRun.setUser(user); flowRun.setName(flowName); flowRun.setRunId(runId); flowRun.setVersion(version); flowRun.setId(flowRun.getId()); flowActivity.addFlowRun(flowRun);
FlowRunEntity flow1 = new FlowRunEntity(); flow1.setUser(user.getId()); flow1.setName("test flow name 1"); flow1.setVersion("test flow version 1"); flow1.setRunId(1L); FlowRunEntity flow2 = new FlowRunEntity(); flow2.setUser(user.getId()); flow2.setName("test flow name 2"); flow2.setVersion("test flow version 2"); flow2.setRunId(2L); flow1.getId()); flow1 .setParent(TimelineEntityType.YARN_CLUSTER.toString(), cluster.getId()); flow1.addChild(TimelineEntityType.YARN_FLOW_RUN.toString(), flow2.getId()); flow2.setParent(TimelineEntityType.YARN_FLOW_RUN.toString(), flow1.getId()); flow2.addChild(TimelineEntityType.YARN_APPLICATION.toString(), app1.getId()); flow2.addChild(TimelineEntityType.YARN_APPLICATION.toString(), app2.getId()); app1.setParent(TimelineEntityType.YARN_FLOW_RUN.toString(), flow2.getId()); app1.addChild(TimelineEntityType.YARN_APPLICATION_ATTEMPT.toString(), appAttempt.getId()); .setParent(TimelineEntityType.YARN_APPLICATION.toString(), app1.getId());
ClusterEntity cluster = new ClusterEntity(); cluster.setId(YarnConfiguration.DEFAULT_RM_CLUSTER_ID); FlowRunEntity flow = new FlowRunEntity(); flow.setUser(UserGroupInformation.getCurrentUser().getShortUserName()); flow.setName("test_flow_name"); flow.setVersion("test_flow_version"); flow.setRunId(1L); flow.setParent(cluster.getType(), cluster.getId()); ApplicationEntity app = new ApplicationEntity(); app.setId(appId.toString()); flow.addChild(app.getType(), app.getId()); ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 1);
public String getVersion() { return (String)getInfo().get(FLOW_VERSION_INFO_KEY); }
public long getMaxEndTime() { Object time = getInfo().get(FLOW_RUN_END_TIME); return time == null ? 0L : ((Number) time).longValue(); }
public String getUser() { return (String)getInfo().get(USER_INFO_KEY); }
public String getName() { return (String)getInfo().get(FLOW_NAME_INFO_KEY); }
public long getRunId() { Object runId = getInfo().get(FLOW_RUN_ID_INFO_KEY); return runId == null ? 0L : ((Number) runId).longValue(); }