Search in sources :

Example 1 with RunIdGenerator

use of org.apache.samza.coordinator.RunIdGenerator in project samza by apache.

the class LocalApplicationRunner method initializeRunId.

private void initializeRunId() {
    if (!isAppModeBatch) {
        LOG.info("Not BATCH mode and hence not generating run id");
        return;
    }
    if (!coordinationUtils.isPresent()) {
        LOG.warn("Coordination utils not present. Aborting run id generation. Will continue execution without a run id.");
        return;
    }
    try {
        MetadataStore metadataStore = getMetadataStoreForRunID();
        runIdGenerator = Optional.of(new RunIdGenerator(coordinationUtils.get(), metadataStore));
        runId = runIdGenerator.flatMap(RunIdGenerator::getRunId);
    } catch (Exception e) {
        LOG.warn("Failed to generate run id. Will continue execution without a run id.", e);
    }
}
Also used : MetadataStore(org.apache.samza.metadatastore.MetadataStore) RunIdGenerator(org.apache.samza.coordinator.RunIdGenerator) ConfigException(org.apache.samza.config.ConfigException) SamzaException(org.apache.samza.SamzaException)

Aggregations

SamzaException (org.apache.samza.SamzaException)1 ConfigException (org.apache.samza.config.ConfigException)1 RunIdGenerator (org.apache.samza.coordinator.RunIdGenerator)1 MetadataStore (org.apache.samza.metadatastore.MetadataStore)1