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

[GitHub] [airflow] bkossakowska opened a new pull request, #31895: Refactor of links in Dataproc

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

   <!--
   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/
   -->
   
   ---
   **^ 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] bkossakowska commented on pull request #31895: Refactor of links in Dataproc

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

   > @bkossakowska can you have the conflicts and rebase the PR?
   
   Hi @eladkal,
   PR is rebased
   


-- 
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 #31895: Refactor of links in Dataproc

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


-- 
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] VladaZakharova commented on pull request #31895: Refactor of links in Dataproc

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

   Hi @potiuk  @eladkal !
   Could you please check the changes? :)


-- 
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] bkossakowska commented on pull request #31895: Refactor of links in Dataproc

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

   Hi @potiuk,
   could you please take a look at the changes? Thanks :)


-- 
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 #31895: Refactor of links in Dataproc

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

   conflicts :(


-- 
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] VladaZakharova commented on pull request #31895: Refactor of links in Dataproc

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

   Hi @uranusjr ! Could you please recheck this PR? Thanks!


-- 
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] uranusjr commented on a diff in pull request #31895: Refactor of links in Dataproc

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


##########
airflow/providers/google/cloud/links/dataproc.py:
##########
@@ -20,99 +20,147 @@
 
 from typing import TYPE_CHECKING
 
-from airflow.models import BaseOperatorLink, XCom
-from airflow.providers.google.cloud.links.base import BASE_LINK
+from airflow.providers.google.cloud.links.base import BASE_LINK, BaseGoogleLink
 
 if TYPE_CHECKING:
     from airflow.models import BaseOperator
-    from airflow.models.taskinstancekey import TaskInstanceKey
     from airflow.utils.context import Context
 
 DATAPROC_BASE_LINK = BASE_LINK + "/dataproc"
-DATAPROC_JOB_LOG_LINK = DATAPROC_BASE_LINK + "/jobs/{resource}?region={region}&project={project_id}"
+DATAPROC_JOB_LINK = DATAPROC_BASE_LINK + "/jobs/{job_id}?region={region}&project={project_id}"
+
 DATAPROC_CLUSTER_LINK = (
-    DATAPROC_BASE_LINK + "/clusters/{resource}/monitoring?region={region}&project={project_id}"
+    DATAPROC_BASE_LINK + "/clusters/{cluster_id}/monitoring?region={region}&project={project_id}"
 )
+
 DATAPROC_WORKFLOW_TEMPLATE_LINK = (
-    DATAPROC_BASE_LINK + "/workflows/templates/{region}/{resource}?project={project_id}"
+    DATAPROC_BASE_LINK + "/workflows/templates/{region}/{workflow_template_id}?project={project_id}"
+)
+DATAPROC_WORKFLOW_LINK = (
+    DATAPROC_BASE_LINK + "/workflows/instances/{region}/{workflow_id}?project={project_id}"
 )
-DATAPROC_WORKFLOW_LINK = DATAPROC_BASE_LINK + "/workflows/instances/{region}/{resource}?project={project_id}"
-DATAPROC_BATCH_LINK = DATAPROC_BASE_LINK + "/batches/{region}/{resource}/monitoring?project={project_id}"
+
+DATAPROC_BATCH_LINK = DATAPROC_BASE_LINK + "/batches/{region}/{batch_id}/monitoring?project={project_id}"
 DATAPROC_BATCHES_LINK = DATAPROC_BASE_LINK + "/batches?project={project_id}"
 
 
-class DataprocLink(BaseOperatorLink):
-    """Helper class for constructing Dataproc resource link."""
+class DataprocClusterLink(BaseGoogleLink):
+    """Helper class for constructing Dataproc Cluster Link."""
 
-    name = "Dataproc resource"
-    key = "conf"
+    name = "Dataproc Cluster"
+    key = "dataproc_cluster"
+    format_str = DATAPROC_CLUSTER_LINK
 
     @staticmethod
     def persist(
         context: Context,
-        task_instance,
-        url: str,
-        resource: str,
+        task_instance: BaseOperator,

Review Comment:
   Is this correct? A variable named `task_instance` should generally be a `TaskInstance` object instead. If the type is accurate, we should consider renaming the argument.



-- 
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] VladaZakharova commented on pull request #31895: Refactor of links in Dataproc

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

   Hi @potiuk !
   Can we review changes? Thanks!


-- 
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] uranusjr commented on a diff in pull request #31895: Refactor of links in Dataproc

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


##########
airflow/providers/google/cloud/links/dataproc.py:
##########
@@ -20,99 +20,151 @@
 
 from typing import TYPE_CHECKING
 
-from airflow.models import BaseOperatorLink, XCom
-from airflow.providers.google.cloud.links.base import BASE_LINK
+from airflow.providers.google.cloud.links.base import BASE_LINK, BaseGoogleLink
 
 if TYPE_CHECKING:
     from airflow.models import BaseOperator
-    from airflow.models.taskinstancekey import TaskInstanceKey
     from airflow.utils.context import Context
 
 DATAPROC_BASE_LINK = BASE_LINK + "/dataproc"
-DATAPROC_JOB_LOG_LINK = DATAPROC_BASE_LINK + "/jobs/{resource}?region={region}&project={project_id}"
+DATAPROC_JOB_LINK = DATAPROC_BASE_LINK + "/jobs/{job_id}?region={region}&project={project_id}"
+
 DATAPROC_CLUSTER_LINK = (
-    DATAPROC_BASE_LINK + "/clusters/{resource}/monitoring?region={region}&project={project_id}"
+    DATAPROC_BASE_LINK + "/clusters/{cluster_id}/monitoring?region={region}&project={project_id}"
 )
+
 DATAPROC_WORKFLOW_TEMPLATE_LINK = (
-    DATAPROC_BASE_LINK + "/workflows/templates/{region}/{resource}?project={project_id}"
+    DATAPROC_BASE_LINK + "/workflows/templates/{region}/{workflow_template_id}?project={project_id}"
+)
+DATAPROC_WORKFLOW_LINK = (
+    DATAPROC_BASE_LINK + "/workflows/instances/{region}/{workflow_id}?project={project_id}"
 )
-DATAPROC_WORKFLOW_LINK = DATAPROC_BASE_LINK + "/workflows/instances/{region}/{resource}?project={project_id}"
-DATAPROC_BATCH_LINK = DATAPROC_BASE_LINK + "/batches/{region}/{resource}/monitoring?project={project_id}"
+
+DATAPROC_BATCH_LINK = DATAPROC_BASE_LINK + "/batches/{region}/{batch_id}/monitoring?project={project_id}"
 DATAPROC_BATCHES_LINK = DATAPROC_BASE_LINK + "/batches?project={project_id}"
 
 
-class DataprocLink(BaseOperatorLink):
-    """Helper class for constructing Dataproc resource link."""
+class DataprocClusterLink(BaseGoogleLink):
+    """Helper class for constructing Dataproc Cluster Link."""
 
-    name = "Dataproc resource"
-    key = "conf"
+    name = "Dataproc Cluster"
+    key = "dataproc_cluster"
+    format_str = DATAPROC_CLUSTER_LINK
 
     @staticmethod
     def persist(
         context: Context,
-        task_instance,
-        url: str,
-        resource: str,
+        operator_instance: BaseOperator,

Review Comment:
   Please call this `task` or `operator` instead; the object is too obviously an instance and the name shouldn’t be lengthened unnecessarily.



-- 
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 #31895: Refactor of links in Dataproc

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

   @bkossakowska can you have the conflicts and rebase the PR?


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