Search in sources :

Example 1 with JobFailed

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

the class ErrorFacetBuilderTest method testBuildErrorFacet.

@Test
public void testBuildErrorFacet() {
    JobFailed failure = new JobFailed(new TestException("The test exception message"));
    SparkListenerJobEnd event = new SparkListenerJobEnd(1, 1L, failure);
    ErrorFacetBuilder builder = new ErrorFacetBuilder();
    assertThat(builder.isDefinedAt(event)).isTrue();
    Map<String, RunFacet> runFacetMap = new HashMap<>();
    builder.build(event, runFacetMap::put);
    assertThat(runFacetMap).hasEntrySatisfying("spark.exception", facet -> assertThat(facet).isInstanceOf(ErrorFacet.class).extracting("message").isEqualTo(failure.exception().getMessage()));
}
Also used : ErrorFacet(io.openlineage.spark.agent.facets.ErrorFacet) JobFailed(org.apache.spark.scheduler.JobFailed) SparkListenerJobEnd(org.apache.spark.scheduler.SparkListenerJobEnd) HashMap(java.util.HashMap) RunFacet(io.openlineage.client.OpenLineage.RunFacet) Test(org.junit.jupiter.api.Test)

Aggregations

RunFacet (io.openlineage.client.OpenLineage.RunFacet)1 ErrorFacet (io.openlineage.spark.agent.facets.ErrorFacet)1 HashMap (java.util.HashMap)1 JobFailed (org.apache.spark.scheduler.JobFailed)1 SparkListenerJobEnd (org.apache.spark.scheduler.SparkListenerJobEnd)1 Test (org.junit.jupiter.api.Test)1