You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/15 11:42:27 UTC

[GitHub] [airflow] wojsamjan opened a new pull request #22280: Add links for BigQuery Data Transfer

wojsamjan opened a new pull request #22280:
URL: https://github.com/apache/airflow/pull/22280


   <!--
   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 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/
   -->
   Add links to assets for BigQuery Data Transfer
   
   Co-authored-by: Wojciech Januszek [januszek@google.com](mailto:januszek@google.com)
   Co-authored-by: Lukasz Wyszomirski [wyszomirski@google.com](mailto:wyszomirski@google.com)
   Co-authored-by: Maksim Yermakou [maksimy@google.com](mailto:maksimy@google.com)
   
   ---
   **^ 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 change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+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 [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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] josh-fell commented on a change in pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#discussion_r827247758



##########
File path: airflow/providers/google/cloud/links/bigquery_dts.py
##########
@@ -0,0 +1,49 @@
+#
+# 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.
+"""This module contains Google BigQuery Data Transfer links."""
+from typing import TYPE_CHECKING, Optional
+
+from airflow.providers.google.cloud.links.base import BaseGoogleLink
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+BIGQUERY_BASE_LINK = "https://console.cloud.google.com/bigquery/transfers"
+BIGQUERY_DTS_LINK = BIGQUERY_BASE_LINK + "/locations/{region}/configs/{config_id}/runs?project={project_id}"
+
+
+class BigQueryDataTransferConfigLink(BaseGoogleLink):
+    """Helper class for constructing BigQuery Data Transfer Config Link"""
+
+    name = "BigQuery Data Transfer Config"
+    key = "bigquery_dts_config"
+    format_str = BIGQUERY_DTS_LINK
+
+    @staticmethod
+    def persist(
+        context: "Context",
+        task_instance,

Review comment:
       Could the type annotation be added here as well?

##########
File path: airflow/providers/google/cloud/links/bigquery_dts.py
##########
@@ -0,0 +1,49 @@
+#
+# 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.
+"""This module contains Google BigQuery Data Transfer links."""
+from typing import TYPE_CHECKING, Optional
+
+from airflow.providers.google.cloud.links.base import BaseGoogleLink
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+BIGQUERY_BASE_LINK = "https://console.cloud.google.com/bigquery/transfers"
+BIGQUERY_DTS_LINK = BIGQUERY_BASE_LINK + "/locations/{region}/configs/{config_id}/runs?project={project_id}"
+
+
+class BigQueryDataTransferConfigLink(BaseGoogleLink):
+    """Helper class for constructing BigQuery Data Transfer Config Link"""
+
+    name = "BigQuery Data Transfer Config"
+    key = "bigquery_dts_config"
+    format_str = BIGQUERY_DTS_LINK
+
+    @staticmethod
+    def persist(
+        context: "Context",
+        task_instance,
+        region: Optional[str],
+        config_id: Optional[str],
+        project_id: Optional[str],

Review comment:
       Are these args truly optional? Looks like they will always be provided when `BigQueryDataTransferConfigLink.persist()` is called but I could be missing something along the way here. I suspect the link value wouldn't be correct if these were missing too?




-- 
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 #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#issuecomment-1084910806


   > Need to resolve conflicts first too.
   
   Updated :)


-- 
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] eladkal commented on pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
eladkal commented on pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#issuecomment-1079934884


   We probably need to update https://github.com/apache/airflow/issues/9941 accordingly


-- 
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 #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#issuecomment-1080014319


   Need to resolve conflicts first too.


-- 
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] josh-fell commented on a change in pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#discussion_r827246403



##########
File path: airflow/providers/google/cloud/links/bigquery_dts.py
##########
@@ -0,0 +1,49 @@
+#
+# 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.
+"""This module contains Google BigQuery Data Transfer links."""
+from typing import TYPE_CHECKING, Optional
+
+from airflow.providers.google.cloud.links.base import BaseGoogleLink
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+BIGQUERY_BASE_LINK = "https://console.cloud.google.com/bigquery/transfers"
+BIGQUERY_DTS_LINK = BIGQUERY_BASE_LINK + "/locations/{region}/configs/{config_id}/runs?project={project_id}"
+
+
+class BigQueryDataTransferConfigLink(BaseGoogleLink):
+    """Helper class for constructing BigQuery Data Transfer Config Link"""
+
+    name = "BigQuery Data Transfer Config"
+    key = "bigquery_dts_config"
+    format_str = BIGQUERY_DTS_LINK
+
+    @staticmethod
+    def persist(
+        context: "Context",
+        task_instance,
+        region: Optional[str],
+        config_id: Optional[str],
+        project_id: Optional[str],

Review comment:
       These args don't seem to be optional. Looks like they will always be provided when `BigQueryDataTransferConfigLink.persist()` is called but I could be missing something along the way here. I suspect the link value wouldn't be correct if these were missing too?
   ```suggestion
           region: str,
           config_id: str,
           project_id: str,
   ```




-- 
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 #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #22280:
URL: https://github.com/apache/airflow/pull/22280


   


-- 
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] turbaszek commented on a change in pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#discussion_r833633553



##########
File path: airflow/providers/google/cloud/sensors/bigquery_dts.py
##########
@@ -130,4 +131,7 @@ def poke(self, context: 'Context') -> bool:
             metadata=self.metadata,
         )
         self.log.info("Status of %s run: %s", self.run_id, str(run.state))
+
+        if run.state in (TransferState.FAILED, TransferState.CANCELLED):
+            raise AirflowException(f"Transfer {self.run_id} did not succeed")

Review comment:
       Is this possibly a breaking change in behavior?




-- 
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 edited a comment on pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#issuecomment-1084910806


   > We probably need to update https://github.com/apache/airflow/issues/9941 accordingly
   
   Updated :)


-- 
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] wojsamjan commented on a change in pull request #22280: Add links for BigQuery Data Transfer

Posted by GitBox <gi...@apache.org>.
wojsamjan commented on a change in pull request #22280:
URL: https://github.com/apache/airflow/pull/22280#discussion_r837716565



##########
File path: airflow/providers/google/cloud/sensors/bigquery_dts.py
##########
@@ -130,4 +131,7 @@ def poke(self, context: 'Context') -> bool:
             metadata=self.metadata,
         )
         self.log.info("Status of %s run: %s", self.run_id, str(run.state))
+
+        if run.state in (TransferState.FAILED, TransferState.CANCELLED):
+            raise AirflowException(f"Transfer {self.run_id} did not succeed")

Review comment:
       Actually, without this it did not work correctly. Before only checking is state in expected (succeed), but what if this already failed? As I understand and implement sensors is: if succeed then return True, if waiting - False, if failed - raise. Otherwise we are waiting for the result which has already failed - what is the reason in this situation?
   The problem I noticed is that the sensor was waiting in loop for the already failed result - what I think is not something expected




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