(self, running_apps, tags)
return spark_apps
Traverses the Spark application master in YARN to get a Spark application ID.

        Return a dictionary of {app_id: (app_name, tracking_url)} for Spark applications
Traverses the Spark application master in YARN to get a Spark application ID.
Traverses the Spark application master in YARN to get a Spark application ID .
def _get_spark_app_ids(self, running_apps, tags):
        """
        Traverses the Spark application master in YARN to get a Spark application ID.

        Return a dictionary of {app_id: (app_name, tracking_url)} for Spark applications
        """
        spark_apps = {}
        version_set = False
        for app_id, (app_name, tracking_url) in iteritems(running_apps):
            try:
                if not version_set:
                    version_set = self._collect_version(tracking_url, tags)
                response = self._rest_request_to_json(tracking_url, SPARK_APPS_PATH, SPARK_SERVICE_CHECK, tags)
            except Exception as e:
                self.log.warning("Exception happened when fetching app ids for %s: %s", tracking_url, e)
                continue

            for app in response:
                app_id = app.get('id')
                app_name = app.get('name')

                if app_id and app_name:
                    spark_apps[app_id] = (app_name, tracking_url)

        return spark_apps
def _get_spark_app_ids ( self , running_apps , tags ) : spark_apps = { } version_set = False for app_id , ( app_name , tracking_url ) in iteritems ( running_apps ) : try : if not version_set : version_set = self . _collect_version ( tracking_url , tags ) response = self . _rest_request_to_json ( tracking_url , SPARK_APPS_PATH , SPARK_SERVICE_CHECK , tags ) except Exception as e : self . log . warning ( "Exception happened when fetching app ids for %s: %s" , tracking_url , e ) continue for app in response : app_id = app . get ( 'id' ) app_name = app . get ( 'name' ) if app_id and app_name : spark_apps [ app_id ] = ( app_name , tracking_url ) return spark_apps