ashb commented on a change in pull request #6715: [AIRFLOW-5945] Make inbuilt 
OperatorLinks work when using Serialization
URL: https://github.com/apache/airflow/pull/6715#discussion_r354553508
 
 

 ##########
 File path: airflow/utils/tests.py
 ##########
 @@ -71,15 +75,70 @@ class Dummy3TestOperator(BaseOperator):
     operator_extra_links = ()
 
 
+@attr.s(auto_attribs=True)
+class CustomBaseIndexOpLink(BaseOperatorLink):
+    index: int = attr.ib()
+
+    @property
+    def name(self) -> str:
+        return 'BigQuery Console #{index}'.format(index=self.index + 1)
+
+    def get_link(self, operator, dttm):
+        ti = TaskInstance(task=operator, execution_date=dttm)
+        search_queries = ti.xcom_pull(task_ids=operator.task_id, 
key='search_query')
+        if not search_queries:
+            return None
+        if len(search_queries) < self.index:
+            return None
+        search_query = search_queries[self.index]
+        return 
'https://console.cloud.google.com/bigquery?j={}'.format(search_query)
+
+
+class CustomBaseOpLink(BaseOperatorLink):
 
 Review comment:
   ```suggestion
   class CustomOpLink(BaseOperatorLink):
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to