(self, running_jobs, addl_tags)
Get metrics for each MapReduce task
        Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task
Get metrics for each MapReduce task
        Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task
Get metrics for each MapReduce task Return a dictionary of { task_id : tracking_url } for each MapReduce task
def _mapreduce_task_metrics(self, running_jobs, addl_tags):
        """
        Get metrics for each MapReduce task
        Return a dictionary of {task_id: 'tracking_url'} for each MapReduce task
        """
        for job_stats in itervalues(running_jobs):

            metrics_json = self._rest_request_to_json(
                job_stats['tracking_url'], 'tasks', self.MAPREDUCE_SERVICE_CHECK, tags=addl_tags
            )

            if metrics_json.get('tasks'):
                if metrics_json['tasks'].get('task'):

                    for task in metrics_json['tasks']['task']:
                        task_type = task.get('type')

                        if task_type:
                            tags = [
                                'app_name:' + job_stats['app_name'],
                                'user_name:' + job_stats['user_name'],
                                'job_name:' + job_stats['job_name'],
                                'task_type:' + str(task_type).lower(),
                            ]

                            tags.extend(addl_tags)

                            if task_type == 'MAP':
                                self._set_metrics_from_json(task, MAPREDUCE_MAP_TASK_METRICS, tags)

                            elif task_type == 'REDUCE':
                                self._set_metrics_from_json(task, MAPREDUCE_REDUCE_TASK_METRICS, tags)
def _mapreduce_task_metrics ( self , running_jobs , addl_tags ) : for job_stats in itervalues ( running_jobs ) : metrics_json = self . _rest_request_to_json ( job_stats [ 'tracking_url' ] , 'tasks' , self . MAPREDUCE_SERVICE_CHECK , tags = addl_tags ) if metrics_json . get ( 'tasks' ) : if metrics_json [ 'tasks' ] . get ( 'task' ) : for task in metrics_json [ 'tasks' ] [ 'task' ] : task_type = task . get ( 'type' ) if task_type : tags = [ 'app_name:' + job_stats [ 'app_name' ] , 'user_name:' + job_stats [ 'user_name' ] , 'job_name:' + job_stats [ 'job_name' ] , 'task_type:' + str ( task_type ) . lower ( ) , ] tags . extend ( addl_tags ) if task_type == 'MAP' : self . _set_metrics_from_json ( task , MAPREDUCE_MAP_TASK_METRICS , tags ) elif task_type == 'REDUCE' : self . _set_metrics_from_json ( task , MAPREDUCE_REDUCE_TASK_METRICS , tags )