You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "adam133 (via GitHub)" <gi...@apache.org> on 2023/07/28 00:46:14 UTC

[GitHub] [airflow] adam133 opened a new pull request, #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

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

   
   <!--
    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/
   -->
   
   closes: #32866
   
   Allow running a databricks delta live tables pipeline by name without knowing the pipeline id.
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.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 [newsfragments](https://github.com/apache/airflow/tree/main/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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1315921657


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   Ah yeah I think that was a copy/paste from elsewhere. Switching it to `batch_size`. Attempting to run what tests I can locally then pushing it up.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1315164068


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   I am happy with both



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1671770111

   > > Needs testing and tests. I just threw this together quickly because I had a bit to look at it. Will also need some documentation updates.
   > 
   > Hello @adam133, I'm very interested in contributing to this project, and I believe this PR would be an excellent place for me to get started. Would you mind if I join?
   
   @lafirm 
   Don't mind at all! I'm having trouble finding the time to finish this one off. I know there's more work to do.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1702760874

   Not sure how to get it to run the full tests again, but the stuff that was failing earlier should be fixed.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1315158864


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   Ywah looks consistent with the API



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1691376074

   Rebased to check - but i think there are still errors 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1703208998

   Ah ok looks like I'll need to do the `breeze` setup and figure out what it's doing...


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1688841619

   Should be good to review I think - let me know!


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1314359427


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   Name of what exactly? Happy to change things, trying to align with how Databricks has them named.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk merged pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #32903:
URL: https://github.com/apache/airflow/pull/32903


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] hussein-awala commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1314011396


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   The name is confusing, I wonder if we can change it.



##########
airflow/providers/databricks/operators/databricks.py:
##########
@@ -384,6 +386,11 @@ def _get_hook(self, caller: str) -> DatabricksHook:
         )
 
     def execute(self, context: Context):
+        if "pipeline_task" in self.json and self.json["pipeline_task"].get("pipeline_id") is None:

Review Comment:
   You need to add an extra check on `pipeline_name`:
   ```suggestion
           if (
               "pipeline_task" in self.json 
               and self.json["pipeline_task"].get("pipeline_id") is None
               and self.json["pipeline_task"].get("pipeline_name")
           ):
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1654815173

   Needs testing and tests. I just threw this together quickly because I had a bit to look at it.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] lafirm commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "lafirm (via GitHub)" <gi...@apache.org>.
lafirm commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1666844222

   > Needs testing and tests. I just threw this together quickly because I had a bit to look at it. Will also need some documentation updates.
   
   Hello @adam133, I'm very interested in contributing to this project, and I believe this PR would be an excellent place for me to get started. Would you mind if I join?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1703879304

   Ok I'm not sure what that latest error means. Does it have anything to do with my changes? Status = queued instead of success?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1709303821

   Awesome work, congrats on your first merged pull request! You are invited to check our [Issue Tracker](https://github.com/apache/airflow/issues) for additional contributions.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1691661682

   Looks like I just needed to add the parameter name for the function call? Should be resolved.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] adam133 commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "adam133 (via GitHub)" <gi...@apache.org>.
adam133 commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1703213054

   Ok _now_ it should be good.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] hussein-awala commented on a diff in pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #32903:
URL: https://github.com/apache/airflow/pull/32903#discussion_r1315161086


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -215,6 +216,67 @@ def find_job_id_by_name(self, job_name: str) -> int | None:
         else:
             return matching_jobs[0]["job_id"]
 
+    def list_pipelines(
+        self, max_results: int = 25, pipeline_name: str | None = None, notebook_path: str | None = None
+    ) -> list[dict[str, Any]]:
+        """
+        Lists the pipelines in Databricks Delta Live Tables.
+
+        :param max_results: The limit/batch size used to retrieve pipelines.

Review Comment:
   Yes it is consistent with the API, but the API uses it to determine the total number of pipelines it should return by query, but in our case we collect all the pipelines, so IMHO `max_results_by_page` or `batch_size` are more suitable. 
   
   It's a nit, if you don't agree you can merge.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #32903: allow DatabricksSubmitRunOperator to accept a pipeline name for a pipeline_task

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #32903:
URL: https://github.com/apache/airflow/pull/32903#issuecomment-1654812396

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org