Search in sources :

Example 1 with ContextFactory

use of io.openlineage.spark.agent.lifecycle.ContextFactory in project OpenLineage by OpenLineage.

the class OpenLineageSparkListener method onApplicationStart.

/**
 * Check the {@link SparkConf} for open lineage configuration.
 *
 * @param applicationStart
 */
@Override
public void onApplicationStart(SparkListenerApplicationStart applicationStart) {
    if (contextFactory != null) {
        return;
    }
    SparkEnv sparkEnv = SparkEnv$.MODULE$.get();
    if (sparkEnv != null) {
        try {
            ArgumentParser args = parseConf(sparkEnv.conf());
            contextFactory = new ContextFactory(new EventEmitter(args));
        } catch (URISyntaxException e) {
            log.error("Unable to parse open lineage endpoint. Lineage events will not be collected", e);
        }
    } else {
        log.warn("Open lineage listener instantiated, but no configuration could be found. " + "Lineage events will not be collected");
    }
}
Also used : ContextFactory(io.openlineage.spark.agent.lifecycle.ContextFactory) SparkEnv(org.apache.spark.SparkEnv) URISyntaxException(java.net.URISyntaxException)

Aggregations

ContextFactory (io.openlineage.spark.agent.lifecycle.ContextFactory)1 URISyntaxException (java.net.URISyntaxException)1 SparkEnv (org.apache.spark.SparkEnv)1