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 2019/04/12 04:39:30 UTC

[GitHub] [airflow] feng-tao commented on a change in pull request #5059: [AIRFLOW-161] New redirect route and extra links

feng-tao commented on a change in pull request #5059: [AIRFLOW-161] New redirect route and extra links
URL: https://github.com/apache/airflow/pull/5059#discussion_r274757308
 
 

 ##########
 File path: airflow/contrib/hooks/qubole_hook.py
 ##########
 @@ -207,6 +210,30 @@ def get_jobs_id(self, ti):
             cmd_id = ti.xcom_pull(key="qbol_cmd_id", task_ids=self.task_id)
         Command.get_jobs_id(self.cls, cmd_id)
 
+    def get_extra_links(self, task, dttm):
+        log = LoggingMixin().log
+        session = settings.Session()
+        url = ''
+
+        try:
+            conn = BaseHook.get_connection(task.kwargs['qubole_conn_id'])
+            if conn and conn.host:
+                host = re.sub(r'api$', 'v2/analyze?command_id=', conn.host)
+            else:
+                host = 'https://api.qubole.com/v2/analyze?command_id='
+
+            ti = TaskInstance(task=task, execution_date=dttm)
+            qds_command_id = ti.xcom_pull(task_ids=task.task_id, key='qbol_cmd_id')
+
+            url = host + str(qds_command_id) if qds_command_id else ''
+        except Exception as e:
+            log.warning('Could not find the url to redirect. Error: %s' % str(e))
 
 Review comment:
   do you what exception will be hit?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services