mik-laj commented on a change in pull request #7535: [AIRFLOW-6915] Adds AI
Platform Console link for MLEngineStartTrainingOperator
URL: https://github.com/apache/airflow/pull/7535#discussion_r385655996
##########
File path: airflow/providers/google/cloud/operators/mlengine.py
##########
@@ -852,6 +853,23 @@ def execute(self, context):
)
+class AIPlatformConsoleLink(BaseOperatorLink):
+ """
+ Helper class for constructing AI Platform Console link.
+ """
+ name = "AI Platform Console"
+
+ def get_link(self, operator, dttm):
+ task_instance = TaskInstance(task=operator, execution_date=dttm)
+ gcp_metadata_dict = task_instance.xcom_pull(task_ids=operator.task_id,
key="gcp_metadata")
+ if not gcp_metadata_dict:
+ return ''
+ job_id = gcp_metadata_dict['job_id']
Review comment:
Yes. A dictionary is created and immediately saved. No operations are
performed on it, so it always has one structure.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services