(self, running_apps, addl_tags)
return running_jobs
Get metrics for each MapReduce job.
        Return a dictionary for each MapReduce job
        {
          job_id: {
            'job_name': job_name,
            'app_name': app_name,
            'user_name': user_name,
            'tracking_url': tracking_url
        }
Get metrics for each MapReduce job.
        Return a dictionary for each MapReduce job
        {
          job_id: {
            'job_name': job_name,
            'app_name': app_name,
            'user_name': user_name,
            'tracking_url': tracking_url
        }
Get metrics for each MapReduce job . Return a dictionary for each MapReduce job { job_id : { job_name : job_name app_name : app_name user_name : user_name tracking_url : tracking_url }
def _mapreduce_job_metrics(self, running_apps, addl_tags):
        """
        Get metrics for each MapReduce job.
        Return a dictionary for each MapReduce job
        {
          job_id: {
            'job_name': job_name,
            'app_name': app_name,
            'user_name': user_name,
            'tracking_url': tracking_url
        }
        """
        running_jobs = {}

        for app_name, tracking_url in itervalues(running_apps):

            metrics_json = self._rest_request_to_json(
                tracking_url, self.MAPREDUCE_JOBS_PATH, self.MAPREDUCE_SERVICE_CHECK
            )

            if metrics_json.get('jobs'):
                if metrics_json['jobs'].get('job'):

                    for job_json in metrics_json['jobs']['job']:
                        job_id = job_json.get('id')
                        job_name = job_json.get('name')
                        user_name = job_json.get('user')

                        if job_id and job_name and user_name:

                            # Build the structure to hold the information for each job ID
                            running_jobs[str(job_id)] = {
                                'job_name': str(job_name),
                                'app_name': str(app_name),
                                'user_name': str(user_name),
                                'tracking_url': self._join_url_dir(tracking_url, self.MAPREDUCE_JOBS_PATH, job_id),
                            }

                            tags = [
                                'app_name:' + str(app_name),
                                'user_name:' + str(user_name),
                                'job_name:' + str(job_name),
                            ]

                            tags.extend(addl_tags)

                            self._set_metrics_from_json(job_json, MAPREDUCE_JOB_METRICS, tags)

        return running_jobs
def _mapreduce_job_metrics ( self , running_apps , addl_tags ) : running_jobs = { } for app_name , tracking_url in itervalues ( running_apps ) : metrics_json = self . _rest_request_to_json ( tracking_url , self . MAPREDUCE_JOBS_PATH , self . MAPREDUCE_SERVICE_CHECK ) if metrics_json . get ( 'jobs' ) : if metrics_json [ 'jobs' ] . get ( 'job' ) : for job_json in metrics_json [ 'jobs' ] [ 'job' ] : job_id = job_json . get ( 'id' ) job_name = job_json . get ( 'name' ) user_name = job_json . get ( 'user' ) if job_id and job_name and user_name : # Build the structure to hold the information for each job ID running_jobs [ str ( job_id ) ] = { 'job_name' : str ( job_name ) , 'app_name' : str ( app_name ) , 'user_name' : str ( user_name ) , 'tracking_url' : self . _join_url_dir ( tracking_url , self . MAPREDUCE_JOBS_PATH , job_id ) , } tags = [ 'app_name:' + str ( app_name ) , 'user_name:' + str ( user_name ) , 'job_name:' + str ( job_name ) , ] tags . extend ( addl_tags ) self . _set_metrics_from_json ( job_json , MAPREDUCE_JOB_METRICS , tags ) return running_jobs