pohek321 commented on issue #19357:
URL: https://github.com/apache/airflow/issues/19357#issuecomment-969396487
@alexott what about adding something like this to the `databricks.py` where
the hook lives:
"""
Please note that any Airflow tasks that call the `get_run_state` method
will result in failure unless you have enabled
xcom pickling. This can be done using the following environment
variable: AIRLFOW_CORE_ENABLE_XCOM_PICKLING=TRUE
If you do not want to enable xcom pickling then use the
`get_run_state_str` method
"""
def get_run_state(self, run_id: str) -> RunState:
"""
Retrieves run state of the run.
:param run_id: id of the run
:return: state of the run
"""
json = {'run_id': run_id}
response = self._do_api_call(GET_RUN_ENDPOINT, json)
state = response['state']
life_cycle_state = state['life_cycle_state']
# result_state may not be in the state if not terminal
result_state = state.get('result_state', None)
state_message = state['state_message']
return RunState(life_cycle_state, result_state, state_message)
def get_run_state_str(self, run_id: str) -> str:
"""
Retrieves run state of the run.
:param run_id: id of the run
:return: state of the run
"""
json = {'run_id': run_id}
response = self._do_api_call(GET_RUN_ENDPOINT, json)
state = response['state']
life_cycle_state = state['life_cycle_state']
state_message = state['state_message']
result = life_cycle_state + ' - ' + state_message
return result
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]