Skip to content
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

feat(airflow) Override datajob external_url #274

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class DatahubLineageConfig(ConfigModel):
# The Airflow plugin behaves as if it were set to True.
graceful_exceptions: bool = True

# Override the external urls of datajob.
override_datajob_url: str = None
gp1105739 marked this conversation as resolved.
Show resolved Hide resolved

def make_emitter_hook(self) -> "DatahubGenericHook":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configs also need to be added to get_lineage_config below, and also added to the docs

# This is necessary to avoid issues with circular imports.
from datahub_airflow_plugin.hooks.datahub import DatahubGenericHook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from datahub.utilities.urns.data_job_urn import DataJobUrn

from datahub_airflow_plugin._airflow_compat import AIRFLOW_PATCHED
from datahub_airflow_plugin.lineage.datahub import get_lineage_backend_config

assert AIRFLOW_PATCHED

Expand Down Expand Up @@ -269,6 +270,11 @@ def generate_datajob(
base_url = conf.get("webserver", "base_url")
datajob.url = f"{base_url}/taskinstance/list/?flt1_dag_id_equals={datajob.flow_urn.get_flow_id()}&_flt_3_task_id={task.task_id}"

config = get_lineage_backend_config()
gp1105739 marked this conversation as resolved.
Show resolved Hide resolved

if config.override_datajob_url:
datajob.url = config.override_datajob_url.format(base_url=base_url, dag_id=datajob.flow_urn.get_flow_id(), task_id=task.task_id)

if capture_owner and dag.owner:
datajob.owners.add(dag.owner)

Expand Down