spark_plugin.py
def _get_standalone_apps(self):
        """
        Retrieve active applications for Spark standalone cluster

        Uses BeautifulSoup module to find driver URL mapped to the specific
        application. The driver URL is the API endpoint required to
        retrieve any application level metrics
        """
        resp = self.spark_agent.request_metrics(self.master, STANDALONE_STATE_PATH)
        apps = {}
        active_apps = {}

        if "activeapps" in resp:
            active_apps = resp["activeapps"]

        for app in active_apps:
            app_id = app.get("id")
            app_name = app.get("name")
            app_user = app.get("user")

            resp = self.spark_agent.rest_request(self.master, STANDALONE_APP_PATH, appId=app_id)
            html = resp.read().decode("utf-8")
            app_url_list = [match.start() for match in re.finditer("Application Detail UI", html)]

            if not app_url_list or len(app_url_list) != 1:
                continue

            end = app_url_list[0]
            quote = html[end - 2]
            start = html.rfind(quote, 0, end - 2)
            if start == -1:
                continue
            tracking_url = html[start + 1 : end - 2]
            apps[app_id] = (app_name, app_user, tracking_url)
            self.metrics[(app_name, app_user)] = {}
        return apps

        Retrieve active applications for Spark standalone cluster

        Uses BeautifulSoup module to find driver URL mapped to the specific
        application. The driver URL is the API endpoint required to
        retrieve any application level metrics
        
Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application. The driver URL is the API endpoint required to
retrieve any application level metrics
Retrieve active applications for Spark standalone cluster Uses BeautifulSoup module to find driver URL mapped to the specific application . The driver URL is the API endpoint required to retrieve any application level metrics
def _get_standalone_apps(self):
        resp = self.spark_agent.request_metrics(self.master, STANDALONE_STATE_PATH)
        apps = {}
        active_apps = {}
        if "activeapps" in resp:
            active_apps = resp["activeapps"]
        for app in active_apps:
            app_id = app.get("id")
            app_name = app.get("name")
            app_user = app.get("user")
            resp = self.spark_agent.rest_request(self.master, STANDALONE_APP_PATH, appId=app_id)
            html = resp.read().decode("utf-8")
            app_url_list = [match.start() for match in re.finditer("Application Detail UI", html)]
            if not app_url_list or len(app_url_list) != 1:
                continue
            end = app_url_list[0]
            quote = html[end - 2]
            start = html.rfind(quote, 0, end - 2)
            if start == -1:
                continue
            tracking_url = html[start + 1 : end - 2]
            apps[app_id] = (app_name, app_user, tracking_url)
            self.metrics[(app_name, app_user)] = {}
        return apps
def _get_standalone_apps ( self ) : resp = self . spark_agent . request_metrics ( self . master , STANDALONE_STATE_PATH ) apps = { } active_apps = { } if "activeapps" in resp : active_apps = resp [ "activeapps" ] for app in active_apps : app_id = app . get ( "id" ) app_name = app . get ( "name" ) app_user = app . get ( "user" ) resp = self . spark_agent . rest_request ( self . master , STANDALONE_APP_PATH , appId = app_id ) html = resp . read ( ) . decode ( "utf-8" ) app_url_list = [ match . start ( ) for match in re . finditer ( "Application Detail UI" , html ) ] if not app_url_list or len ( app_url_list ) != 1 : continue end = app_url_list [ 0 ] quote = html [ end - 2 ] start = html . rfind ( quote , 0 , end - 2 ) if start == - 1 : continue tracking_url = html [ start + 1 : end - 2 ] apps [ app_id ] = ( app_name , app_user , tracking_url ) self . metrics [ ( app_name , app_user ) ] = { } return apps
Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application.
Retrieve active applications for Spark standalone cluster Uses BeautifulSoup module to find driver URL mapped to the specific application .
"""
        Retrieve active applications for Spark standalone cluster

        Uses BeautifulSoup module to find driver URL mapped to the specific
        application. The driver URL is the API endpoint required to
        retrieve any application level metrics
        """
self