fjmacagno opened a new pull request, #53039:
URL: https://github.com/apache/airflow/pull/53039

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   Fixes a problem with the update_job_permission databricks hook method where 
when run with newer versions of the databricks sdk it crashes with a 404. The 
fix is to remove `api/` from the start of the path, which is automatically 
added by the databricks sdk. I am assuming this is a safe change because all 
the other endpoints do not include `api/` at the start, implying this one fell 
through the cracks.
   
   ```
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.12/site-packages/airflow/providers/databricks/hooks/databricks_base.py",
 line 672, in _do_api_call
       for attempt in self._get_retry_object():
                      ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
443, in __iter__
       do = self.iter(retry_state=retry_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
376, in iter
       result = action(retry_state)
                ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 
398, in <lambda>
       self._add_action_func(lambda rs: rs.outcome.result())
                                        ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in 
result
       return self.__get_result()
              ^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in 
__get_result
       raise self._exception
     File 
"/usr/local/lib/python3.12/site-packages/airflow/providers/databricks/hooks/databricks_base.py",
 line 691, in _do_api_call
       response.raise_for_status()
     File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 
1024, in raise_for_status
       raise HTTPError(http_error_msg, response=self)
   requests.exceptions.HTTPError: 404 Client Error: Not Found for url: 
https://<>/api/api/2.0/permissions/jobs/807588172815468
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 
768, in _execute_task
       result = _execute_callable(context=context, **execute_callable_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 
734, in _execute_callable
       return ExecutionCallableRunner(
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/utils/operator_helpers.py", 
line 252, in run
       return self.func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/models/baseoperator.py", line 
424, in wrapper
       return func(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/providers/databricks/operators/databricks.py",
 line 402, in execute
       self._hook.update_job_permission(job_id, 
normalise_json_content(acl_json))
     File 
"/usr/local/lib/python3.12/site-packages/airflow/providers/databricks/hooks/databricks.py",
 line 773, in update_job_permission
       return self._do_api_call(("PATCH", 
f"api/2.0/permissions/jobs/{job_id}"), json)
              
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.12/site-packages/airflow/providers/databricks/hooks/databricks_base.py",
 line 698, in _do_api_call
       raise AirflowException(msg)
   airflow.exceptions.AirflowException: Response: {"error":"Bad Target: 
/api/api/2.0/permissions/jobs/807588172815468"}
   , Status Code: 404
   ```
   
   **^ Add meaningful description above**
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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]

Reply via email to