-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(metadata-integration/openlineage): support env and orchestrator in openlineage event emission #15251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(metadata-integration/openlineage): support env and orchestrator in openlineage event emission #15251
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f6ab892
feat(metadata-integration/openlineage): support env and orchestrator …
acrylJonny 7b88b18
adding testing
acrylJonny 811b851
Update OpenLineageServletConfigTest.java
acrylJonny 9ca3a92
addressing feedback
acrylJonny d41a18c
Merge branch 'master' into openlineage-improvements-nov
acrylJonny 873958e
Merge branch 'master' into openlineage-improvements-nov
acrylJonny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
...nlineage-converter/src/test/java/io/datahubproject/openlineage/OpenLineageConfigTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| package io.datahubproject.openlineage; | ||
|
|
||
| import static org.testng.Assert.assertEquals; | ||
| import static org.testng.Assert.assertNotNull; | ||
|
|
||
| import com.linkedin.common.FabricType; | ||
| import io.datahubproject.openlineage.config.DatahubOpenlineageConfig; | ||
| import io.datahubproject.openlineage.converter.OpenLineageToDataHub; | ||
| import io.datahubproject.openlineage.dataset.DatahubJob; | ||
| import io.openlineage.client.OpenLineage; | ||
| import java.net.URI; | ||
| import java.time.ZonedDateTime; | ||
| import java.util.UUID; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| /** Tests for OpenLineage configuration including orchestrator and fabric type */ | ||
| public class OpenLineageConfigTest { | ||
|
|
||
| private OpenLineage.RunEvent createTestEvent(URI producerUri) { | ||
| OpenLineage openLineage = new OpenLineage(producerUri); | ||
| return openLineage | ||
| .newRunEventBuilder() | ||
| .eventTime(ZonedDateTime.now()) | ||
| .eventType(OpenLineage.RunEvent.EventType.START) | ||
| .run(openLineage.newRunBuilder().runId(UUID.randomUUID()).build()) | ||
| .job( | ||
| openLineage | ||
| .newJobBuilder() | ||
| .namespace("test-namespace") | ||
| .name("test-job") | ||
| .facets(openLineage.newJobFacetsBuilder().build()) | ||
| .build()) | ||
| .inputs(java.util.Collections.emptyList()) | ||
| .outputs(java.util.Collections.emptyList()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testOrchestratorOverride() throws Exception { | ||
| // Create config with orchestrator override | ||
| DatahubOpenlineageConfig config = | ||
| DatahubOpenlineageConfig.builder() | ||
| .fabricType(FabricType.PROD) | ||
| .orchestrator("custom-orchestrator") | ||
| .build(); | ||
|
|
||
| OpenLineage.RunEvent runEvent = | ||
| createTestEvent(URI.create("https://github.com/OpenLineage/OpenLineage/")); | ||
|
|
||
| DatahubJob datahubJob = OpenLineageToDataHub.convertRunEventToJob(runEvent, config); | ||
|
|
||
| assertNotNull(datahubJob); | ||
| assertEquals( | ||
| datahubJob.getFlowUrn().getOrchestratorEntity(), | ||
| "custom-orchestrator", | ||
| "Orchestrator should be overridden to custom-orchestrator"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testOrchestratorFromProducerUrl() throws Exception { | ||
| // Test with an Airflow producer URL and no override | ||
| DatahubOpenlineageConfig config = | ||
| DatahubOpenlineageConfig.builder().fabricType(FabricType.PROD).build(); | ||
|
|
||
| URI producerUri = URI.create("https://github.com/apache/airflow/"); | ||
| OpenLineage.RunEvent runEvent = createTestEvent(producerUri); | ||
|
|
||
| DatahubJob datahubJob = OpenLineageToDataHub.convertRunEventToJob(runEvent, config); | ||
|
|
||
| assertNotNull(datahubJob); | ||
| assertEquals( | ||
| datahubJob.getFlowUrn().getOrchestratorEntity(), | ||
| "airflow", | ||
| "Orchestrator should be derived from Airflow producer URL"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testOrchestratorOverrideTakesPrecedence() throws Exception { | ||
| // Even if producer URL suggests Airflow, override should win | ||
| DatahubOpenlineageConfig config = | ||
| DatahubOpenlineageConfig.builder() | ||
| .fabricType(FabricType.DEV) | ||
| .orchestrator("my-platform") | ||
| .build(); | ||
|
|
||
| URI producerUri = URI.create("https://github.com/apache/airflow/"); | ||
| OpenLineage.RunEvent runEvent = createTestEvent(producerUri); | ||
|
|
||
| DatahubJob datahubJob = OpenLineageToDataHub.convertRunEventToJob(runEvent, config); | ||
|
|
||
| assertNotNull(datahubJob); | ||
| assertEquals( | ||
| datahubJob.getFlowUrn().getOrchestratorEntity(), | ||
| "my-platform", | ||
| "Orchestrator override should take precedence over producer URL"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testFabricTypeConfiguration() throws Exception { | ||
| // Test that fabric type can be configured (fabric applies to datasets, not flows) | ||
| DatahubOpenlineageConfig config = | ||
| DatahubOpenlineageConfig.builder() | ||
| .fabricType(FabricType.QA) | ||
| .orchestrator("test-orchestrator") | ||
| .build(); | ||
|
|
||
| OpenLineage.RunEvent runEvent = | ||
| createTestEvent(URI.create("https://github.com/OpenLineage/OpenLineage/")); | ||
|
|
||
| DatahubJob datahubJob = OpenLineageToDataHub.convertRunEventToJob(runEvent, config); | ||
|
|
||
| assertNotNull(datahubJob); | ||
| // Fabric type is applied to datasets not flows, which is tested in existing tests | ||
| assertEquals(config.getFabricType(), FabricType.QA, "Config should have QA fabric type"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testDefaultFabricTypeIsProd() throws Exception { | ||
| // Test that default fabric type is PROD when not specified | ||
| // Need to set orchestrator since no producer URL pattern will match | ||
| DatahubOpenlineageConfig config = | ||
| DatahubOpenlineageConfig.builder().orchestrator("test").build(); | ||
|
|
||
| OpenLineage.RunEvent runEvent = | ||
| createTestEvent(URI.create("https://github.com/OpenLineage/OpenLineage/spark/")); | ||
|
|
||
| DatahubJob datahubJob = OpenLineageToDataHub.convertRunEventToJob(runEvent, config); | ||
|
|
||
| assertNotNull(datahubJob); | ||
| // Fabric type default is tested via the config | ||
| assertEquals(config.getFabricType(), FabricType.PROD, "Default fabric should be PROD"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.