/** * Sets the {@link LauncherTypeEnum} for this {@link JobState}. */ public void setJobLauncherType(LauncherTypeEnum jobLauncherType) { this.setProp(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, jobLauncherType.name()); }
/** * Submits an event for the given {@link JobState}. */ private void submitJobStateEvent(JobState jobState) { ImmutableMap.Builder<String, String> jobMetadataBuilder = new ImmutableMap.Builder<>(); jobMetadataBuilder.put(METADATA_JOB_ID, jobState.getJobId()); jobMetadataBuilder.put(METADATA_JOB_NAME, jobState.getJobName()); jobMetadataBuilder.put(METADATA_JOB_START_TIME, Long.toString(jobState.getStartTime())); jobMetadataBuilder.put(METADATA_JOB_END_TIME, Long.toString(jobState.getEndTime())); jobMetadataBuilder.put(METADATA_JOB_STATE, jobState.getState().toString()); jobMetadataBuilder.put(METADATA_JOB_LAUNCHED_TASKS, Integer.toString(jobState.getTaskCount())); jobMetadataBuilder.put(METADATA_JOB_COMPLETED_TASKS, Integer.toString(jobState.getCompletedTasks())); jobMetadataBuilder.put(METADATA_JOB_LAUNCHER_TYPE, jobState.getLauncherType().toString()); jobMetadataBuilder.put(METADATA_JOB_TRACKING_URL, jobState.getTrackingURL().or(UNKNOWN_VALUE)); jobMetadataBuilder.put(EventSubmitter.EVENT_TYPE, JOB_STATE); this.eventSubmitter.submit(JOB_STATE, jobMetadataBuilder.build()); }
String launcherType = rs.getString("launcher_type"); if (!Strings.isNullOrEmpty(launcherType)) { jobExecutionInfo.setLauncherType(LauncherTypeEnum.valueOf(launcherType));
String launcherType = rs.getString("launcher_type"); if (!Strings.isNullOrEmpty(launcherType)) { jobExecutionInfo.setLauncherType(LauncherTypeEnum.valueOf(launcherType));
/** * Submits an event for the given {@link JobState}. */ private void submitJobStateEvent(JobState jobState) { ImmutableMap.Builder<String, String> jobMetadataBuilder = new ImmutableMap.Builder<>(); jobMetadataBuilder.put(METADATA_JOB_ID, jobState.getJobId()); jobMetadataBuilder.put(METADATA_JOB_NAME, jobState.getJobName()); jobMetadataBuilder.put(METADATA_JOB_START_TIME, Long.toString(jobState.getStartTime())); jobMetadataBuilder.put(METADATA_JOB_END_TIME, Long.toString(jobState.getEndTime())); jobMetadataBuilder.put(METADATA_JOB_STATE, jobState.getState().toString()); jobMetadataBuilder.put(METADATA_JOB_LAUNCHED_TASKS, Integer.toString(jobState.getTaskCount())); jobMetadataBuilder.put(METADATA_JOB_COMPLETED_TASKS, Integer.toString(jobState.getCompletedTasks())); jobMetadataBuilder.put(METADATA_JOB_LAUNCHER_TYPE, jobState.getLauncherType().toString()); jobMetadataBuilder.put(METADATA_JOB_TRACKING_URL, jobState.getTrackingURL().or(UNKNOWN_VALUE)); jobMetadataBuilder.put(EventSubmitter.EVENT_TYPE, JOB_STATE); this.eventSubmitter.submit(JOB_STATE, jobMetadataBuilder.build()); }
@Override protected String getLauncherType(JobExecutionInfo info) { if (info.hasLauncherType()) { return info.getLauncherType().name(); } return null; } }
String launcherType = rs.getString("launcher_type"); if (!Strings.isNullOrEmpty(launcherType)) { jobExecutionInfo.setLauncherType(LauncherTypeEnum.valueOf(launcherType));
.print(new Period(jobExecutionInfo.getDuration().longValue())) : "-")); data.add(Arrays.asList("Tracking URL", jobExecutionInfo.getTrackingUrl())); data.add(Arrays.asList("Launcher Type", jobExecutionInfo.getLauncherType().name()));
String launcherType = rs.getString("launcher_type"); if (!Strings.isNullOrEmpty(launcherType)) { jobExecutionInfo.setLauncherType(LauncherTypeEnum.valueOf(launcherType));
private static void updateJobExecutionInfo(Connection connection, JobExecutionInfo info) throws SQLException { Preconditions.checkArgument(info.hasJobId()); try (PreparedStatement updateStatement = connection.prepareStatement(JOB_EXECUTION_UPDATE_STATEMENT_TEMPLATE)) { int index = 0; updateStatement .setTimestamp(++index, info.hasStartTime() ? new Timestamp(info.getStartTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); updateStatement.setTimestamp(++index, info.hasEndTime() ? new Timestamp(info.getEndTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); updateStatement.setLong(++index, info.hasDuration() ? info.getDuration() : -1); updateStatement.setString(++index, info.hasState() ? info.getState().name() : null); updateStatement.setInt(++index, info.hasLaunchedTasks() ? info.getLaunchedTasks() : -1); updateStatement.setInt(++index, info.hasCompletedTasks() ? info.getCompletedTasks() : -1); updateStatement.setString(++index, info.hasLauncherType() ? info.getLauncherType().name() : null); updateStatement.setString(++index, info.hasTrackingUrl() ? info.getTrackingUrl() : null); updateStatement.setString(++index, info.getJobId()); updateStatement.executeUpdate(); } }
private static void insertJobExecutionInfo(Connection connection, JobExecutionInfo info) throws SQLException { Preconditions.checkArgument(info.hasJobName()); Preconditions.checkArgument(info.hasJobId()); try (PreparedStatement insertStatement = connection.prepareStatement(JOB_EXECUTION_INSERT_STATEMENT_TEMPLATE)) { int index = 0; insertStatement.setString(++index, info.getJobName()); insertStatement.setString(++index, info.getJobId()); insertStatement .setTimestamp(++index, info.hasStartTime() ? new Timestamp(info.getStartTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); insertStatement.setTimestamp(++index, info.hasEndTime() ? new Timestamp(info.getEndTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); insertStatement.setLong(++index, info.hasDuration() ? info.getDuration() : -1); insertStatement.setString(++index, info.hasState() ? info.getState().name() : null); insertStatement.setInt(++index, info.hasLaunchedTasks() ? info.getLaunchedTasks() : -1); insertStatement.setInt(++index, info.hasCompletedTasks() ? info.getCompletedTasks() : -1); insertStatement.setString(++index, info.hasLauncherType() ? info.getLauncherType().name() : null); insertStatement.setString(++index, info.hasTrackingUrl() ? info.getTrackingUrl() : null); insertStatement.executeUpdate(); } }
/** * Sets the {@link LauncherTypeEnum} for this {@link JobState}. */ public void setJobLauncherType(LauncherTypeEnum jobLauncherType) { this.setProp(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, jobLauncherType.name()); }
@Override protected String getLauncherType(JobExecutionInfo info) { if (info.hasLauncherType()) { return info.getLauncherType().name(); } return null; } }
.print(new Period(jobExecutionInfo.getDuration().longValue())) : "-")); data.add(Arrays.asList("Tracking URL", jobExecutionInfo.getTrackingUrl())); data.add(Arrays.asList("Launcher Type", jobExecutionInfo.getLauncherType().name()));
private static void insertJobExecutionInfo(Connection connection, JobExecutionInfo info) throws SQLException { Preconditions.checkArgument(info.hasJobName()); Preconditions.checkArgument(info.hasJobId()); try (PreparedStatement insertStatement = connection.prepareStatement(JOB_EXECUTION_INSERT_STATEMENT_TEMPLATE)) { int index = 0; insertStatement.setString(++index, info.getJobName()); insertStatement.setString(++index, info.getJobId()); insertStatement .setTimestamp(++index, info.hasStartTime() ? new Timestamp(info.getStartTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); insertStatement.setTimestamp(++index, info.hasEndTime() ? new Timestamp(info.getEndTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); insertStatement.setLong(++index, info.hasDuration() ? info.getDuration() : -1); insertStatement.setString(++index, info.hasState() ? info.getState().name() : null); insertStatement.setInt(++index, info.hasLaunchedTasks() ? info.getLaunchedTasks() : -1); insertStatement.setInt(++index, info.hasCompletedTasks() ? info.getCompletedTasks() : -1); insertStatement.setString(++index, info.hasLauncherType() ? info.getLauncherType().name() : null); insertStatement.setString(++index, info.hasTrackingUrl() ? info.getTrackingUrl() : null); insertStatement.executeUpdate(); } }
private static void updateJobExecutionInfo(Connection connection, JobExecutionInfo info) throws SQLException { Preconditions.checkArgument(info.hasJobId()); try (PreparedStatement updateStatement = connection.prepareStatement(JOB_EXECUTION_UPDATE_STATEMENT_TEMPLATE)) { int index = 0; updateStatement .setTimestamp(++index, info.hasStartTime() ? new Timestamp(info.getStartTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); updateStatement.setTimestamp(++index, info.hasEndTime() ? new Timestamp(info.getEndTime()) : DEFAULT_TIMESTAMP, getCalendarUTCInstance()); updateStatement.setLong(++index, info.hasDuration() ? info.getDuration() : -1); updateStatement.setString(++index, info.hasState() ? info.getState().name() : null); updateStatement.setInt(++index, info.hasLaunchedTasks() ? info.getLaunchedTasks() : -1); updateStatement.setInt(++index, info.hasCompletedTasks() ? info.getCompletedTasks() : -1); updateStatement.setString(++index, info.hasLauncherType() ? info.getLauncherType().name() : null); updateStatement.setString(++index, info.hasTrackingUrl() ? info.getTrackingUrl() : null); updateStatement.setString(++index, info.getJobId()); updateStatement.executeUpdate(); } }