def get_link( self, operator: "AbstractOperator", dttm: Optional[datetime] = None, *, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: """ Get link to qubole command result page. :param operator: operator :param dttm: datetime :return: url link """ conn = BaseHook.get_connection( getattr(operator, "qubole_conn_id", None) or operator.kwargs['qubole_conn_id'] # type: ignore[attr-defined] ) 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=' if ti_key: qds_command_id = XCom.get_value(key='qbol_cmd_id', ti_key=ti_key) else: assert dttm qds_command_id = XCom.get_one( key='qbol_cmd_id', dag_id=operator.dag_id, task_id=operator.task_id, execution_date=dttm ) url = host + str(qds_command_id) if qds_command_id else '' return url
def get_link( self, operator, dttm=None, *, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: if ti_key: run_id = XCom.get_value(key="run_id", ti_key=ti_key) else: assert dttm run_id = XCom.get_one( key="run_id", dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, ) conn = BaseHook.get_connection(operator.azure_data_factory_conn_id) subscription_id = conn.extra_dejson[ "extra__azure_data_factory__subscriptionId"] # Both Resource Group Name and Factory Name can either be declared in the Azure Data Factory # connection or passed directly to the operator. resource_group_name = operator.resource_group_name or conn.extra_dejson.get( "extra__azure_data_factory__resource_group_name") factory_name = operator.factory_name or conn.extra_dejson.get( "extra__azure_data_factory__factory_name") url = ( f"https://adf.azure.com/en-us/monitoring/pipelineruns/{run_id}" f"?factory=/subscriptions/{subscription_id}/" f"resourceGroups/{resource_group_name}/providers/Microsoft.DataFactory/" f"factories/{factory_name}") return url
def get_link( self, operator, dttm: Optional[datetime] = None, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: """ Link to Amazon Web Services Console. :param operator: airflow operator :param ti_key: TaskInstance ID to return link for :param dttm: execution date. Uses for compatibility with Airflow 2.2 :return: link to external system """ if ti_key is not None: conf = XCom.get_value(key=self.key, ti_key=ti_key) elif not dttm: conf = {} else: conf = XCom.get_one( key=self.key, dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, ) return self.format_link(**conf) if conf else ""
def get_link( self, operator, dttm: Optional[datetime] = None, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: """ Get link to EMR cluster. :param operator: operator :param dttm: datetime :return: url link """ if ti_key is not None: flow_id = XCom.get_value(key="return_value", ti_key=ti_key) else: assert dttm flow_id = XCom.get_one( key="return_value", dag_id=operator.dag_id, task_id=operator.task_id, execution_date=dttm ) return ( f'https://console.aws.amazon.com/elasticmapreduce/home#cluster-details:{flow_id}' if flow_id else '' )
def get_link(self, operator, dttm=None, *, ti_key=None): if ti_key is not None: job_run_url = XCom.get_value(key="job_run_url", ti_key=ti_key) else: assert dttm job_run_url = XCom.get_one(dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, key="job_run_url") return job_run_url
def get_link( self, operator, dttm: Optional[datetime] = None, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: if ti_key is not None: conf = XCom.get_value(key=self.key, ti_key=ti_key) else: assert dttm conf = XCom.get_one(key=self.key, dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm) return (conf["url"].format(region=conf["region"], project_id=conf["project_id"], resource=conf["resource"]) if conf else "")
def get_link( self, operator, dttm: Optional[datetime] = None, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: if ti_key is not None: conf = XCom.get_value(key=self.key, ti_key=ti_key) else: assert dttm conf = XCom.get_one( key=self.key, dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, ) return self.format_str.format(**conf) if conf else ""
def get_link( self, operator, dttm: Optional[datetime] = None, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: if ti_key is not None: list_conf = XCom.get_value(key=self.key, ti_key=ti_key) else: assert dttm list_conf = XCom.get_one( key=self.key, dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, ) return (list_conf["url"].format(project_id=list_conf["project_id"], ) if list_conf else "")
def get_link( self, operator, dttm=None, *, ti_key: Optional["TaskInstanceKey"] = None, ) -> str: if ti_key is not None: run_page_url = XCom.get_value(key=XCOM_RUN_PAGE_URL_KEY, ti_key=ti_key) else: assert dttm run_page_url = XCom.get_one( key=XCOM_RUN_PAGE_URL_KEY, dag_id=operator.dag.dag_id, task_id=operator.task_id, execution_date=dttm, ) return run_page_url