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

add deferrable support to DatabricksNotebookOperator #39295

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

rawwar
Copy link
Collaborator

@rawwar rawwar commented Apr 28, 2024

related: #39178

This PR intends to make DatabricksNotebookOperator deferrable

@rawwar rawwar marked this pull request as ready for review May 5, 2024 10:48
@rawwar rawwar requested a review from pankajkoti May 6, 2024 10:32
@rawwar rawwar requested a review from Lee-W May 6, 2024 11:38
Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

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

implementation looks good, but it would be better if we can add some test

@rawwar rawwar requested a review from Lee-W May 12, 2024 00:54
"Task failed. Final state %s. Reason: %s",
run_state.result_state,
run_state.state_message,
f"Task failed. Final state {run_state.result_state}. Reason: {run_state.state_message}"
Copy link
Collaborator Author

@rawwar rawwar May 12, 2024

Choose a reason for hiding this comment

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

@pankajkoti , I updated this exception call. The reason is that AirflowException just extend the Base Exception class and all the extra arguments we send are not actually used to parse the final exception message.

example:

>>> from airflow.exceptions import AirflowException
>>> raise AirflowException("This is %s", "Hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
airflow.exceptions.AirflowException: ('This is %s', 'Hello')

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

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

One nitpick. Everything else looks good to me

)
operator.databricks_run_id = 12345

with pytest.raises(TaskDeferred):
Copy link
Member

Choose a reason for hiding this comment

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

assert isinstance(exc.value.trigger, HttpTrigger), "Trigger is not a HttpTrigger"

let's extend the test like this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added it. Also added one more assert to check the method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants