Skip to content

Fix failing Databricks tests #292

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 1 commit into from
May 2, 2022
Merged

Fix failing Databricks tests #292

merged 1 commit into from
May 2, 2022

Conversation

pankajkoti
Copy link
Collaborator

@pankajkoti pankajkoti commented Apr 29, 2022

Following tests for Databricks are failing and observed in a non-related PR: #290

  1. test_databricks_submit_run_operator_async
  2. test_databricks_run_now_operator_async

The reason for failure is that the execute method called in these
tests is trying to push an XCOM against task instance 'ti' of
the context. Previously, context was an empty dictionary missing
the 'ti' key. We now are using the create_context utility to
generate a context object which includes the 'ti' key against which
the XCOM is getting pushed.

Closes: #291

Following tests for Databricks are failing and observed in a non-related PR: #290

1. test_databricks_submit_run_operator_async
2. test_databricks_run_now_operator_async

The reason for failure is that the execute method called in these
tests is trying to push an XCOM against task instance 'ti' of
the context. Previously, context was an empty dictionary missing
the 'ti' key. We now are using the create_context utility to
generate a context object which includes the 'ti' key against which
the XCOM is getting pushed.
@pankajkoti
Copy link
Collaborator Author

I observed Databricks tests failing as part of this PR: #290 and hence created a separate issue and PR to fix these here. Once this is merged to main, I will get these changes into my branch.

@codecov
Copy link

codecov bot commented Apr 29, 2022

Codecov Report

Merging #292 (dc47db9) into main (8310221) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #292   +/-   ##
=======================================
  Coverage   96.61%   96.61%           
=======================================
  Files          53       53           
  Lines        2834     2834           
=======================================
  Hits         2738     2738           
  Misses         96       96           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8310221...dc47db9. Read the comment docs.

@pankajastro
Copy link
Contributor

pankajastro commented Apr 29, 2022

By default, the value of do_xcom_push param is false of DatabricksSubmitRunOperator and DatabricksRunNowOperator and also I can see in these particular tests we are not setting param do_xcom_push so it is weird that the test is failing.

When do_xcom_push is false it should not push value to the xcom.

@pankajkoti
Copy link
Collaborator Author

pankajkoti commented Apr 29, 2022

By default, the value of do_xcom_push param is false of DatabricksSubmitRunOperator and DatabricksRunNowOperator and also I can see in these particular tests we are not setting param do_xcom_push so it is weird that the test is failing.

Yes, weird why it's failing only in my PR: https://app.circleci.com/pipelines/github/astronomer/astronomer-providers/1445/workflows/6a04ddcb-3480-4f37-b321-0e735af0f7a4/jobs/4527

But, I believe, we need this fix anyway, right @pankajastro ?

@pankajastro
Copy link
Contributor

pankajastro commented Apr 29, 2022

By default, the value of do_xcom_push param is false of DatabricksSubmitRunOperator and DatabricksRunNowOperator and also I can see in these particular tests we are not setting param do_xcom_push so it is weird that the test is failing.

Yes, weird why it's failing only in my PR: https://app.circleci.com/pipelines/github/astronomer/astronomer-providers/1445/workflows/6a04ddcb-3480-4f37-b321-0e735af0f7a4/jobs/4527

But, I believe, we need this fix anyway, right @pankajastro ?

wait, In my local airflow code I can see the default value for do_xocm_push param is false but in airflow main, I see it is true https://github.com/apache/airflow/blob/main/airflow/providers/databricks/operators/databricks.py#L315 @kaxil @phanikumv

@phanikumv
Copy link
Collaborator

By default, the value of do_xcom_push param is false of DatabricksSubmitRunOperator and DatabricksRunNowOperator and also I can see in these particular tests we are not setting param do_xcom_push so it is weird that the test is failing.

Yes, weird why it's failing only in my PR: https://app.circleci.com/pipelines/github/astronomer/astronomer-providers/1445/workflows/6a04ddcb-3480-4f37-b321-0e735af0f7a4/jobs/4527
But, I believe, we need this fix anyway, right @pankajastro ?

wait, In my local airflow code I can see the default value for do_xocm_push param is false but in airflow main, I see it is true https://github.com/apache/airflow/blob/main/airflow/providers/databricks/operators/databricks.py#L315 @kaxil @phanikumv

Ideally the behaviour should be same as that of apache airflow

@kaxil
Copy link
Collaborator

kaxil commented Apr 29, 2022

Looks like it was changed recently - apache/airflow#22541 on the main branch of Airflow which is also released as part of databircks provider 2.6.0 - https://airflow.apache.org/docs/apache-airflow-providers-databricks/stable/index.html#id1

@pankajastro
Copy link
Contributor

Looks like it was changed recently - apache/airflow#22541 on the main branch of Airflow which is also released as part of databircks provider 2.6.0 - https://airflow.apache.org/docs/apache-airflow-providers-databricks/stable/index.html#id1

Yes, we are having this issue because of airflow databricks operator behaviour change. But, because of this change, there will be a backward compatibility issue for others also.

@pankajkoti
Copy link
Collaborator Author

I think in general for Airflow, most places I see the value set to True. Irrespective of the value, I believe we should have the fix in this PR for the tests by creating the needed context. Please let me know if you have alternative thoughts.

@phanikumv phanikumv merged commit e674172 into main May 2, 2022
@phanikumv phanikumv deleted the 291-fix-databricks-tests branch May 2, 2022 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix failing Databricks tests
4 participants