(self, init_config)
return job_counter
Return a dictionary for each job counter
        {
          job_name: {
            counter_group_name: [
                counter_name
              ]
            }
          }
        }
Return a dictionary for each job counter
        {
          job_name: {
            counter_group_name: [
                counter_name
              ]
            }
          }
        }
Return a dictionary for each job counter { job_name : { counter_group_name : [ counter_name ] } } }
def _parse_job_specific_counters(self, init_config):
        """
        Return a dictionary for each job counter
        {
          job_name: {
            counter_group_name: [
                counter_name
              ]
            }
          }
        }
        """
        job_counter = {}

        if init_config.get('job_specific_counters'):

            # Parse the custom metrics
            for job in init_config['job_specific_counters']:
                job_name = job.get('job_name')
                metrics = job.get('metrics')

                if not job_name:
                    raise Exception('Counter metrics must have a "job_name"')

                if not metrics:
                    raise Exception("Jobs specified in counter metrics must contain at least one metric")

                # Add the job to the custom metrics if it doesn't already exist
                if job_name not in job_counter:
                    job_counter[job_name] = {}

                for metric in metrics:
                    counter_group_name = metric.get('counter_group_name')
                    counters = metric.get('counters')

                    if not counter_group_name:
                        raise Exception('Each counter metric must contain a valid "counter_group_name"')

                    if not counters:
                        raise Exception('Each counter metric must contain a list of "counters"')

                    # Add the counter group name if it doesn't exist for the current job
                    if counter_group_name not in job_counter[job_name]:
                        job_counter[job_name][counter_group_name] = []

                    for counter in counters:
                        counter_name = counter.get('counter_name')

                        if not counter_name:
                            raise Exception('At least one "counter_name" should be specified in the list of "counters"')

                        job_counter[job_name][counter_group_name].append(counter_name)

        return job_counter
def _parse_job_specific_counters ( self , init_config ) : job_counter = { } if init_config . get ( 'job_specific_counters' ) : # Parse the custom metrics for job in init_config [ 'job_specific_counters' ] : job_name = job . get ( 'job_name' ) metrics = job . get ( 'metrics' ) if not job_name : raise Exception ( 'Counter metrics must have a "job_name"' ) if not metrics : raise Exception ( "Jobs specified in counter metrics must contain at least one metric" ) # Add the job to the custom metrics if it doesn't already exist if job_name not in job_counter : job_counter [ job_name ] = { } for metric in metrics : counter_group_name = metric . get ( 'counter_group_name' ) counters = metric . get ( 'counters' ) if not counter_group_name : raise Exception ( 'Each counter metric must contain a valid "counter_group_name"' ) if not counters : raise Exception ( 'Each counter metric must contain a list of "counters"' ) # Add the counter group name if it doesn't exist for the current job if counter_group_name not in job_counter [ job_name ] : job_counter [ job_name ] [ counter_group_name ] = [ ] for counter in counters : counter_name = counter . get ( 'counter_name' ) if not counter_name : raise Exception ( 'At least one "counter_name" should be specified in the list of "counters"' ) job_counter [ job_name ] [ counter_group_name ] . append ( counter_name ) return job_counter