Search in sources :

Example 1 with SparkListenerJobEnd

use of org.apache.spark.scheduler.SparkListenerJobEnd in project kylo by Teradata.

the class DeletePathsListenerTest method testFlag.

/**
 * Verify file exists if flag is false.
 */
@Test
public void testFlag() {
    final SparkListenerJobEnd event = new SparkListenerJobEnd(1, 0, JobSucceeded$.MODULE$);
    apply(false, event);
    Assert.assertTrue("Expected file to exist", tempFile.exists());
}
Also used : SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) Test(org.junit.Test)

Example 2 with SparkListenerJobEnd

use of org.apache.spark.scheduler.SparkListenerJobEnd in project OpenLineage by OpenLineage.

the class LogicalPlanRunFacetBuilderTest method testIsNotDefinedWithoutQueryExecution.

@Test
public void testIsNotDefinedWithoutQueryExecution() {
    LogicalPlanRunFacetBuilder builder = new LogicalPlanRunFacetBuilder(OpenLineageContext.builder().sparkContext(sparkContext).openLineage(new OpenLineage(OpenLineageClient.OPEN_LINEAGE_CLIENT_URI)).build());
    assertThat(builder.isDefinedAt(new SparkListenerSQLExecutionStart(1L, "", "", "", null, 1L))).isFalse();
    assertThat(builder.isDefinedAt(new SparkListenerSQLExecutionEnd(1L, 1L))).isFalse();
    assertThat(builder.isDefinedAt(new SparkListenerJobEnd(1, 1L, JobSucceeded$.MODULE$))).isFalse();
    assertThat(builder.isDefinedAt(new SparkListenerJobStart(1, 1L, Seq$.MODULE$.empty(), new Properties()))).isFalse();
}
Also used : SparkListenerSQLExecutionStart(org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionStart) SparkListenerSQLExecutionEnd(org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionEnd) SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) SparkListenerJobStart(org.apache.spark.scheduler.SparkListenerJobStart) OpenLineage(io.openlineage.client.OpenLineage) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Example 3 with SparkListenerJobEnd

use of org.apache.spark.scheduler.SparkListenerJobEnd in project OpenLineage by OpenLineage.

the class LogicalPlanRunFacetBuilderTest method testIsDefined.

@Test
public void testIsDefined() {
    LogicalPlanRunFacetBuilder builder = new LogicalPlanRunFacetBuilder(OpenLineageContext.builder().sparkContext(sparkContext).openLineage(new OpenLineage(OpenLineageClient.OPEN_LINEAGE_CLIENT_URI)).queryExecution(queryExecution).build());
    assertThat(builder.isDefinedAt(new SparkListenerSQLExecutionStart(1L, "", "", "", null, 1L))).isTrue();
    assertThat(builder.isDefinedAt(new SparkListenerSQLExecutionEnd(1L, 1L))).isTrue();
    assertThat(builder.isDefinedAt(new SparkListenerJobEnd(1, 1L, JobSucceeded$.MODULE$))).isTrue();
    assertThat(builder.isDefinedAt(new SparkListenerJobStart(1, 1L, Seq$.MODULE$.empty(), new Properties()))).isFalse();
}
Also used : SparkListenerSQLExecutionStart(org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionStart) SparkListenerSQLExecutionEnd(org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionEnd) SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) SparkListenerJobStart(org.apache.spark.scheduler.SparkListenerJobStart) OpenLineage(io.openlineage.client.OpenLineage) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Example 4 with SparkListenerJobEnd

use of org.apache.spark.scheduler.SparkListenerJobEnd in project OpenLineage by OpenLineage.

the class AbstractQueryPlanDatasetBuilderTest method testApplyOnBuilderWithGenericArg.

@Test
public void testApplyOnBuilderWithGenericArg() {
    SparkSession session = SparkSession.builder().config("spark.sql.warehouse.dir", "/tmp/warehouse").master("local").getOrCreate();
    OpenLineage openLineage = new OpenLineage(OpenLineageClient.OPEN_LINEAGE_CLIENT_URI);
    InputDataset expected = openLineage.newInputDataset("namespace", "the_name", null, null);
    OpenLineageContext context = createContext(session, openLineage);
    MyGenericArgInputDatasetBuilder<SparkListenerJobEnd> builder = new MyGenericArgInputDatasetBuilder<>(context, true, expected);
    SparkListenerJobEnd jobEnd = new SparkListenerJobEnd(1, 2, null);
    // Even though our instance of builder is parameterized with SparkListenerJobEnd, it's not
    // *compiled* with that argument, so the isDefinedAt method fails to resolve the type arg
    Assertions.assertFalse(((PartialFunction) builder).isDefinedAt(jobEnd));
}
Also used : SparkSession(org.apache.spark.sql.SparkSession) InputDataset(io.openlineage.client.OpenLineage.InputDataset) SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) OpenLineage(io.openlineage.client.OpenLineage) Test(org.junit.jupiter.api.Test)

Example 5 with SparkListenerJobEnd

use of org.apache.spark.scheduler.SparkListenerJobEnd in project OpenLineage by OpenLineage.

the class ErrorFacetBuilderTest method testIsUndefinedForJobSuccess.

@Test
public void testIsUndefinedForJobSuccess() {
    SparkListenerJobEnd event = new SparkListenerJobEnd(1, 1L, JobSucceeded$.MODULE$);
    assertThat(new ErrorFacetBuilder().isDefinedAt(event)).isFalse();
}
Also used : SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) Test(org.junit.jupiter.api.Test)

Aggregations

SparkListenerJobEnd (org.apache.spark.scheduler.SparkListenerJobEnd)16 Test (org.junit.jupiter.api.Test)10 OpenLineage (io.openlineage.client.OpenLineage)9 SparkListenerJobStart (org.apache.spark.scheduler.SparkListenerJobStart)4 SparkListenerSQLExecutionEnd (org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionEnd)4 InputDataset (io.openlineage.client.OpenLineage.InputDataset)3 Properties (java.util.Properties)3 SparkSession (org.apache.spark.sql.SparkSession)3 SparkListenerSQLExecutionStart (org.apache.spark.sql.execution.ui.SparkListenerSQLExecutionStart)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 Nonnull (javax.annotation.Nonnull)2 SparkListener (org.apache.spark.scheduler.SparkListener)2 SparkListenerStageCompleted (org.apache.spark.scheduler.SparkListenerStageCompleted)2 KyloCatalogClientV1 (com.thinkbiganalytics.kylo.catalog.spark.KyloCatalogClientV1)1 KyloCatalogClientV2 (com.thinkbiganalytics.kylo.catalog.spark.KyloCatalogClientV2)1 OutputDatasetFacet (io.openlineage.client.OpenLineage.OutputDatasetFacet)1 RunFacet (io.openlineage.client.OpenLineage.RunFacet)1 ErrorFacet (io.openlineage.spark.agent.facets.ErrorFacet)1 URI (java.net.URI)1