@Override public void addTags(MetadataEntity metadataEntity, String... tags) { addTags(metadataEntity, Arrays.asList(tags)); }
/** * Returns the {@link ClassLoader} used for program method invocation. */ public final ClassLoader getProgramInvocationClassLoader() { ClassLoader classLoader = programInvocationClassLoader; if (classLoader != null) { return classLoader; } synchronized (this) { classLoader = programInvocationClassLoader; if (classLoader != null) { return classLoader; } classLoader = programInvocationClassLoader = createProgramInvocationClassLoader(); return classLoader; } }
@Override public void execute(final TxRunnable runnable) throws TransactionFailureException { execute(runnable, false); }
@Override public String toString() { return String.format("namespaceId=%s, applicationId=%s, program=%s, runid=%s", getNamespaceId(), getApplicationId(), getProgramName(), programRunId.getRun()); }
this.cConf = cConf; this.programRunId = program.getId().run(ProgramRunners.getRunId(programOptions)); this.triggeringScheduleInfo = getTriggeringScheduleInfo(programOptions); this.discoveryServiceClient = discoveryServiceClient; this.owners = createOwners(program.getId()); this.runtimeArguments = Collections.unmodifiableMap(runtimeArgs); this.programMetrics = createProgramMetrics(programRunId, getMetricsService(cConf, metricsService, runtimeArgs), metricsTags); this.userMetrics = new ProgramUserMetrics(programMetrics); retryStrategy, principalId); this.secureStore = secureStore; this.defaultTxTimeout = determineTransactionTimeout(cConf); this.transactional = Transactions.createTransactional(getDatasetCache(), defaultTxTimeout); this.metadataReader = metadataReader; this.metadataPublisher = metadataPublisher;
try { if (TransactionControl.IMPLICIT == txControl) { execute(context -> program.destroy(), retryOnConflict); } else { execute(program::destroy); ProgramRunId programRunId = getProgramRunId(); LOG.error("Exception raised on destroy lifecycle method in class {} of the {} program of run {}", getProgram().getMainClassName(), programRunId.getType().getPrettyName(), programRunId, t);
@Override public <T extends Dataset> T getDataset(String name, Map<String, String> arguments) throws DatasetInstantiationException { return getDataset(name, arguments, AccessType.UNKNOWN); }
public static ProvidedOutput transform(Output.DatasetOutput datasetOutput, AbstractContext abstractContext) { String datasetNamespace = datasetOutput.getNamespace(); if (datasetNamespace == null) { datasetNamespace = abstractContext.getNamespace(); } String datasetName = datasetOutput.getName(); Map<String, String> args = datasetOutput.getArguments(); Dataset dataset = abstractContext.getDataset(datasetNamespace, datasetName, args, AccessType.WRITE); DatasetOutputFormatProvider datasetOutputFormatProvider = new DatasetOutputFormatProvider(datasetNamespace, datasetName, args, dataset); return new ProvidedOutput(datasetOutput, datasetOutputFormatProvider); } }
@Override public void close() { super.close(); // destroy all of the ProgramLifeCycles registered RuntimeException ex = null; for (ProgramLifecycle programLifecycle : programLifecycles) { try { programLifecycle.destroy(); } catch (RuntimeException e) { if (ex == null) { ex = new RuntimeException(e); } else { ex.addSuppressed(e); } } } if (ex != null) { throw ex; } }
this.cConf = cConf; this.programRunId = program.getId().run(ProgramRunners.getRunId(programOptions)); this.triggeringScheduleInfo = getTriggeringScheduleInfo(programOptions); this.discoveryServiceClient = discoveryServiceClient; this.owners = createOwners(program.getId()); this.runtimeArguments = Collections.unmodifiableMap(runtimeArgs); this.programMetrics = createProgramMetrics(programRunId, getMetricsService(cConf, metricsService, runtimeArgs), metricsTags); this.userMetrics = new ProgramUserMetrics(programMetrics); retryStrategy, principalId, namespaceQueryAdmin); this.secureStore = secureStore; this.defaultTxTimeout = determineTransactionTimeout(cConf); this.transactional = Transactions.createTransactional(getDatasetCache(), defaultTxTimeout); this.metadataReader = metadataReader; this.metadataPublisher = metadataPublisher;
@Override public String toString() { return String.format("namespaceId=%s, applicationId=%s, program=%s, runid=%s", getNamespaceId(), getApplicationId(), getProgramName(), programRunId.getRun()); }
try { if (TransactionControl.IMPLICIT == txControl) { execute(context -> program.destroy(), retryOnConflict); } else { execute(program::destroy); ProgramRunId programRunId = getProgramRunId(); LOG.error("Exception raised on destroy lifecycle method in class {} of the {} program of run {}", getProgram().getMainClassName(), programRunId.getType().getPrettyName(), programRunId, t);
@Override public <T extends Dataset> T getDataset(String name) throws DatasetInstantiationException { return getDataset(name, RuntimeArguments.NO_ARGUMENTS); }
public static ProvidedOutput transform(Output.DatasetOutput datasetOutput, AbstractContext abstractContext) { String datasetNamespace = datasetOutput.getNamespace(); if (datasetNamespace == null) { datasetNamespace = abstractContext.getNamespace(); } String datasetName = datasetOutput.getName(); Map<String, String> args = datasetOutput.getArguments(); Dataset dataset = abstractContext.getDataset(datasetNamespace, datasetName, args, AccessType.WRITE); DatasetOutputFormatProvider datasetOutputFormatProvider = new DatasetOutputFormatProvider(datasetNamespace, datasetName, args, dataset); return new ProvidedOutput(datasetOutput, datasetOutputFormatProvider); } }
@Override public void close() { super.close(); // destroy all of the ProgramLifeCycles registered RuntimeException ex = null; for (ProgramLifecycle programLifecycle : programLifecycles) { try { programLifecycle.destroy(); } catch (RuntimeException e) { if (ex == null) { ex = new RuntimeException(e); } else { ex.addSuppressed(e); } } } if (ex != null) { throw ex; } }
@Override public <T extends Dataset> T getDataset(String namespace, String name, Map<String, String> arguments) throws DatasetInstantiationException { return getDataset(namespace, name, arguments, AccessType.UNKNOWN); }
@Override public void execute(final TxRunnable runnable) throws TransactionFailureException { execute(runnable, false); }
@Override public void addTags(MetadataEntity metadataEntity, String... tags) { addTags(metadataEntity, Arrays.asList(tags)); }
/** * Returns the {@link ClassLoader} used for program method invocation. */ public final ClassLoader getProgramInvocationClassLoader() { ClassLoader classLoader = programInvocationClassLoader; if (classLoader != null) { return classLoader; } synchronized (this) { classLoader = programInvocationClassLoader; if (classLoader != null) { return classLoader; } classLoader = programInvocationClassLoader = createProgramInvocationClassLoader(); return classLoader; } }
@Override public <T extends Dataset> T getDataset(String name, Map<String, String> arguments) throws DatasetInstantiationException { return getDataset(name, arguments, AccessType.UNKNOWN); }