(self, tags)
return running_apps
Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications.
Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications.
Return a dictionary of { app_id : ( app_name tracking_url ) } for running Spark applications .
def _mesos_init(self, tags):
        """
        Return a dictionary of {app_id: (app_name, tracking_url)} for running Spark applications.
        """
        running_apps = {}

        metrics_json = self._rest_request_to_json(self.master_address, MESOS_MASTER_APP_PATH, MESOS_SERVICE_CHECK, tags)

        if metrics_json.get('frameworks'):
            for app_json in metrics_json.get('frameworks'):
                app_id = app_json.get('id')
                tracking_url = app_json.get('webui_url')
                app_name = app_json.get('name')

                if app_id and tracking_url and app_name:
                    spark_ports = self.instance.get('spark_ui_ports')
                    if spark_ports is None:
                        # No filtering by port, just return all the frameworks
                        running_apps[app_id] = (app_name, tracking_url)
                    else:
                        # Only return the frameworks running on the correct port
                        tracking_url_port = urlparse(tracking_url).port
                        if tracking_url_port in spark_ports:
                            running_apps[app_id] = (app_name, tracking_url)

        # Report success after gathering all metrics from ResourceManager
        self.service_check(
            MESOS_SERVICE_CHECK,
            AgentCheck.OK,
            tags=['url:%s' % self.master_address] + tags,
        )

        return running_apps
def _mesos_init ( self , tags ) : running_apps = { } metrics_json = self . _rest_request_to_json ( self . master_address , MESOS_MASTER_APP_PATH , MESOS_SERVICE_CHECK , tags ) if metrics_json . get ( 'frameworks' ) : for app_json in metrics_json . get ( 'frameworks' ) : app_id = app_json . get ( 'id' ) tracking_url = app_json . get ( 'webui_url' ) app_name = app_json . get ( 'name' ) if app_id and tracking_url and app_name : spark_ports = self . instance . get ( 'spark_ui_ports' ) if spark_ports is None : # No filtering by port, just return all the frameworks running_apps [ app_id ] = ( app_name , tracking_url ) else : # Only return the frameworks running on the correct port tracking_url_port = urlparse ( tracking_url ) . port if tracking_url_port in spark_ports : running_apps [ app_id ] = ( app_name , tracking_url ) # Report success after gathering all metrics from ResourceManager self . service_check ( MESOS_SERVICE_CHECK , AgentCheck . OK , tags = [ 'url:%s' % self . master_address ] + tags , ) return running_apps