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

fix(airflow): fix xcom pull in _try_to_adopt_job #80

Merged
merged 1 commit into from
Jul 18, 2024
Merged
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
16 changes: 14 additions & 2 deletions spark_on_k8s/airflow/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,22 @@ def _persist_spark_history_ui_link(self, context: Context):
def _try_to_adopt_job(self, context: Context, spark_app_manager: SparkAppManager) -> bool:
from spark_on_k8s.utils.spark_app_status import SparkAppStatus

xcom_driver_namespace = context["ti"].xcom_pull(key=self._XCOM_DRIVER_POD_NAMESPACE)
xcom_driver_namespace = context["ti"].xcom_pull(
dag_id=context["ti"].dag_id,
task_ids=context["ti"].task_id,
map_indexes=context["ti"].map_index,
key=self._XCOM_DRIVER_POD_NAMESPACE,
include_prior_dates=True,
)
if not xcom_driver_namespace or xcom_driver_namespace != self.namespace:
return False
xcom_driver_pod_name = context["ti"].xcom_pull(key=self._XCOM_DRIVER_POD_NAME)
xcom_driver_pod_name = context["ti"].xcom_pull(
dag_id=context["ti"].dag_id,
task_ids=context["ti"].task_id,
map_indexes=context["ti"].map_index,
key=self._XCOM_DRIVER_POD_NAME,
include_prior_dates=True,
)
if xcom_driver_pod_name:
with contextlib.suppress(Exception):
app_status = spark_app_manager.app_status(
Expand Down
Loading