@Alpha public abstract class BaseFlowToJobSpecCompiler extends Object implements SpecCompiler
SpecCatalogListener.AddSpecCallback, SpecCatalogListener.DeleteSpecCallback, SpecCatalogListener.UpdateSpecCallback| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected com.typesafe.config.Config |
config |
protected com.google.common.base.Optional<com.codahale.metrics.Timer> |
dataAuthorizationTimer |
protected com.google.common.base.Optional<com.codahale.metrics.Meter> |
flowCompilationFailedMeter |
protected com.google.common.base.Optional<com.codahale.metrics.Meter> |
flowCompilationSuccessFulMeter |
protected com.google.common.base.Optional<com.codahale.metrics.Timer> |
flowCompilationTimer |
protected org.slf4j.Logger |
log |
protected org.apache.gobblin.metrics.MetricContext |
metricContext |
protected com.google.common.base.Optional<FSJobCatalog> |
templateCatalog |
protected Map<URI,TopologySpec> |
topologySpecMap |
| Constructor and Description |
|---|
BaseFlowToJobSpecCompiler(com.typesafe.config.Config config) |
BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
boolean instrumentationEnabled) |
BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
com.google.common.base.Optional<org.slf4j.Logger> log) |
BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
com.google.common.base.Optional<org.slf4j.Logger> log,
boolean instrumentationEnabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitHealthy()
Waits for the
SpecCompiler to become healthy. |
abstract Dag<JobExecutionPlan> |
compileFlow(Spec spec)
Take in a logical
Spec and compile corresponding materialized Specs
and the mapping to SpecExecutor that they can be run on. |
List<org.apache.gobblin.metrics.Tag<?>> |
generateTags(State state) |
org.apache.gobblin.metrics.MetricContext |
getMetricContext() |
Map<URI,TopologySpec> |
getTopologySpecMap()
|
boolean |
isInstrumentationEnabled() |
protected JobSpec |
jobSpecGenerator(FlowSpec flowSpec)
Naive implementation of generating jobSpec, which fetch the first available template,
in an exemplified single-hop FlowCompiler implementation.
|
protected URI |
jobSpecTemplateURIGenerator(FlowSpec flowSpec)
It returns the template uri for job.
|
URI |
jobSpecURIGenerator(Object... objects)
It can receive multiple number of parameters, needed to generate a unique URI.
|
AddSpecResponse |
onAddSpec(Spec addedSpec) |
void |
onDeleteSpec(URI deletedSpecURI,
String deletedSpecVersion) |
void |
onDeleteSpec(URI deletedSpecURI,
String deletedSpecVersion,
Properties headers) |
void |
onUpdateSpec(Spec updatedSpec) |
void |
switchMetricContext(List<org.apache.gobblin.metrics.Tag<?>> tags) |
void |
switchMetricContext(org.apache.gobblin.metrics.MetricContext context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetActivegetNameprotected final Map<URI,TopologySpec> topologySpecMap
protected final com.typesafe.config.Config config
protected final org.slf4j.Logger log
protected final com.google.common.base.Optional<FSJobCatalog> templateCatalog
protected final org.apache.gobblin.metrics.MetricContext metricContext
protected com.google.common.base.Optional<com.codahale.metrics.Meter> flowCompilationSuccessFulMeter
protected com.google.common.base.Optional<com.codahale.metrics.Meter> flowCompilationFailedMeter
protected com.google.common.base.Optional<com.codahale.metrics.Timer> flowCompilationTimer
protected com.google.common.base.Optional<com.codahale.metrics.Timer> dataAuthorizationTimer
protected boolean active
public BaseFlowToJobSpecCompiler(com.typesafe.config.Config config)
public BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
boolean instrumentationEnabled)
public BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
com.google.common.base.Optional<org.slf4j.Logger> log)
public BaseFlowToJobSpecCompiler(com.typesafe.config.Config config,
com.google.common.base.Optional<org.slf4j.Logger> log,
boolean instrumentationEnabled)
public void awaitHealthy()
throws InterruptedException
SpecCompilerSpecCompiler to become healthy. A SpecCompiler is healthy when all the component
services it depends on have been successfully initialized. For instance, the MultiHopFlowCompiler is healthy
when the DataNodes and FlowEdges
can be added to the FlowGraph. The FlowEdge
instantiation in turn depends on the successful initialization of TopologyCatalog, which
instantiates all the configured SpecExecutors.awaitHealthy in interface SpecCompilerInterruptedExceptionpublic AddSpecResponse onAddSpec(Spec addedSpec)
onAddSpec in interface SpecCatalogListenerpublic void onDeleteSpec(URI deletedSpecURI, String deletedSpecVersion, Properties headers)
onDeleteSpec in interface SpecCatalogListenerpublic void onUpdateSpec(Spec updatedSpec)
onUpdateSpec in interface SpecCatalogListener@Nonnull public org.apache.gobblin.metrics.MetricContext getMetricContext()
getMetricContext in interface Instrumentablepublic boolean isInstrumentationEnabled()
isInstrumentationEnabled in interface Instrumentablepublic List<org.apache.gobblin.metrics.Tag<?>> generateTags(State state)
generateTags in interface Instrumentablepublic void switchMetricContext(List<org.apache.gobblin.metrics.Tag<?>> tags)
switchMetricContext in interface Instrumentablepublic void switchMetricContext(org.apache.gobblin.metrics.MetricContext context)
switchMetricContext in interface Instrumentablepublic Map<URI,TopologySpec> getTopologySpecMap()
SpecCompilergetTopologySpecMap in interface SpecCompilerSpec URI and TopologySpecpublic abstract Dag<JobExecutionPlan> compileFlow(Spec spec)
SpecCompilerSpec and compile corresponding materialized Specs
and the mapping to SpecExecutor that they can be run on.
All the specs generated from the compileFlow must have a
"flow.executionId"compileFlow in interface SpecCompilerspec - Spec to compile.Spec and SpecExecutor.protected JobSpec jobSpecGenerator(FlowSpec flowSpec)
flowSpec - public URI jobSpecURIGenerator(Object... objects)
KafkaJobMonitor extract job name to find the state store path.objects -