@Override public ProgramType getType() { return programRunId.getType(); }
@Override public void failed(Service.State from, Throwable failure) { Throwable rootCause = Throwables.getRootCause(failure); LOG.error("{} Program '{}' failed.", getProgramRunId().getType(), getProgramRunId().getProgram(), failure); USERLOG.error("{} program '{}' failed with error: {}. Please check the system logs for more details.", getProgramRunId().getType(), getProgramRunId().getProgram(), rootCause.getMessage(), rootCause); serviceStoppedLatch.countDown(); error(failure); }
@Override public void failed(Service.State from, Throwable failure) { Throwable rootCause = Throwables.getRootCause(failure); LOG.error("{} Program '{}' failed.", getProgramRunId().getType(), getProgramRunId().getProgram(), failure); USERLOG.error("{} program '{}' failed with error: {}. Please check the system logs for more details.", getProgramRunId().getType(), getProgramRunId().getProgram(), rootCause.getMessage(), rootCause); serviceStoppedLatch.countDown(); error(failure); }
@Override public Iterable<String> toIdParts() { return Collections.unmodifiableList( Arrays.asList(getNamespace(), getApplication(), getVersion(), getType().getPrettyName().toLowerCase(), getProgram(), run) ); }
@Override public Iterable<String> toIdParts() { return Collections.unmodifiableList( Arrays.asList(getNamespace(), getApplication(), getVersion(), getType().getPrettyName().toLowerCase(), getProgram(), run) ); }
@Override public int hashCode() { Integer hashCode = this.hashCode; if (hashCode == null) { this.hashCode = hashCode = Objects.hash(super.hashCode(), getNamespace(), getApplication(), getVersion(), getType(), getProgram(), run); } return hashCode; }
@Override public int hashCode() { Integer hashCode = this.hashCode; if (hashCode == null) { this.hashCode = hashCode = Objects.hash(super.hashCode(), getNamespace(), getApplication(), getVersion(), getType(), getProgram(), run); } return hashCode; }
@Override protected void destroyHandler(SparkHttpServiceHandler handler) { TransactionControl txCtrl = Transactions.getTransactionControl(TransactionControl.EXPLICIT, Object.class, handler, "destroy"); try { execute(() -> handler.destroy(), txCtrl == TransactionControl.IMPLICIT); } catch (Throwable t) { // Don't propagate exception raised by destroy() method ProgramRunId programRunId = runtimeContext.getProgramRunId(); LOG.error("Exception raised on destroy lifecycle method in class {} of the {} program of run {}", getProgram().getMainClassName(), programRunId.getType().getPrettyName(), programRunId, t); } }
@Override protected void destroyHandler(SparkHttpServiceHandler handler) { TransactionControl txCtrl = Transactions.getTransactionControl(TransactionControl.EXPLICIT, Object.class, handler, "destroy"); try { execute(() -> handler.destroy(), txCtrl == TransactionControl.IMPLICIT); } catch (Throwable t) { // Don't propagate exception raised by destroy() method ProgramRunId programRunId = runtimeContext.getProgramRunId(); LOG.error("Exception raised on destroy lifecycle method in class {} of the {} program of run {}", getProgram().getMainClassName(), programRunId.getType().getPrettyName(), programRunId, t); } }
public static LoggingContext getLoggingContextWithRunId(ProgramRunId programRun, Map<String, String> systemArgs) { return getLoggingContext(programRun.getNamespace(), programRun.getApplication(), programRun.getProgram(), programRun.getType(), programRun.getRun(), systemArgs); }
private Map<String, String> getMetricsTags(ProgramRunId programRunId, ProfileId profileId) { return ImmutableMap.<String, String>builder() .put(Constants.Metrics.Tag.PROFILE_SCOPE, profileId.getScope().name()) .put(Constants.Metrics.Tag.PROFILE, profileId.getProfile()) .put(Constants.Metrics.Tag.NAMESPACE, programRunId.getNamespace()) .put(Constants.Metrics.Tag.PROGRAM_TYPE, programRunId.getType().getPrettyName()) .put(Constants.Metrics.Tag.APP, programRunId.getApplication()) .put(Constants.Metrics.Tag.PROGRAM, programRunId.getProgram()) .put(Constants.Metrics.Tag.RUN_ID, programRunId.getRun()) .build(); }
@Override public ProgramId getParent() { return new ProgramId(new ApplicationId(getNamespace(), getApplication(), getVersion()), getType(), getProgram()); }
protected MDSKey.Builder getProgramKeyBuilder(String recordType, @Nullable ProgramRunId programRunId) { MDSKey.Builder builder = new MDSKey.Builder().add(recordType); if (programRunId != null) { builder.add(programRunId.getNamespace()); builder.add(programRunId.getApplication()); builder.add(programRunId.getVersion()); builder.add(programRunId.getType().name()); builder.add(programRunId.getProgram()); builder.add(programRunId.getRun()); } return builder; } }
public DashboardProgramRunRecord(ProgramRunId runId, RunRecord runRecord, ArtifactId artifactId, String user, String startMethod) { this(runId.getNamespace(), ArtifactSummary.from(artifactId), new ApplicationNameVersion(runId.getApplication(), runId.getVersion()), runId.getType().name(), runId.getProgram(), runId.getRun(), user, startMethod, runRecord.getStartTs(), runRecord.getRunTs(), runRecord.getSuspendTs(), runRecord.getResumeTs(), runRecord.getStopTs(), runRecord.getStatus()); }
public DashboardProgramRunRecord(ProgramRunId runId, RunRecord runRecord, ArtifactId artifactId, String user, String startMethod) { this(runId.getNamespace(), ArtifactSummary.from(artifactId), new ApplicationNameVersion(runId.getApplication(), runId.getVersion()), runId.getType().name(), runId.getProgram(), runId.getRun(), user, startMethod, runRecord.getStartTs(), runRecord.getRunTs(), runRecord.getSuspendTs(), runRecord.getResumeTs(), runRecord.getStopTs(), runRecord.getStatus()); }
private byte[] createRowKey(long timestampInSeconds, ProgramRunId programRunId) { MDSKey.Builder builder = new MDSKey.Builder(); // add namespace at the beginning builder.add(programRunId.getNamespace()); // add timestamp builder.add(timestampInSeconds); // add program runId fields, skip namespace as that is part of row key builder.add(programRunId.getApplication()); builder.add(programRunId.getType().name()); builder.add(programRunId.getProgram()); builder.add(programRunId.getRun()); return builder.build().getKey(); }
private MDSKey getKey(ProgramRunId programRunId) { return new MDSKey.Builder().add(KEY_PREFIX) .add(programRunId.getNamespace()) .add(programRunId.getApplication()) .add(programRunId.getVersion()) .add(programRunId.getType().name()) .add(programRunId.getProgram()) .add(programRunId.getRun()) .build(); }
private MDSKey getKey(ProgramRunId programRunId) { return new MDSKey.Builder().add(KEY_PREFIX) .add(programRunId.getNamespace()) .add(programRunId.getApplication()) .add(programRunId.getVersion()) .add(programRunId.getType().name()) .add(programRunId.getProgram()) .add(programRunId.getRun()) .build(); }
private MDSKey getRowKey(ProvisioningTaskKey key) { ProgramRunId programRunId = key.getProgramRunId(); return new MDSKey.Builder().add(STATE_PREFIX) .add(programRunId.getNamespace()) .add(programRunId.getApplication()) .add(programRunId.getVersion()) .add(programRunId.getType().name()) .add(programRunId.getProgram()) .add(programRunId.getRun()) .add(key.getType().name()) .build(); } }
private MDSKey getRowKey(ProvisioningTaskKey key) { ProgramRunId programRunId = key.getProgramRunId(); return new MDSKey.Builder().add(STATE_PREFIX) .add(programRunId.getNamespace()) .add(programRunId.getApplication()) .add(programRunId.getVersion()) .add(programRunId.getType().name()) .add(programRunId.getProgram()) .add(programRunId.getRun()) .add(key.getType().name()) .build(); } }