jobs = self._get_nomad_jobs()
parameterized_jobs = [job for job in jobs if job["ParameterizedJob"]]
aggregated_jobs_by_type = groupby(parameterized_jobs, lambda job: self._get_job_details(job)[0])
nomad_pending_jobs_by_type, nomad_running_jobs_by_type = self._aggregate_nomad_jobs(aggregated_jobs_by_type)
// To get the total jobs for running and pending, the easiest
// AND the most efficient way is to sum up the stats we"ve
After Change
parameterized_jobs = [job for job in jobs if job["ParameterizedJob"]]
// groupby must be executed on a sorted iterable https://docs.python.org/2/library/itertools.html//itertools.groupby
sorted_jobs_by_type = sorted(filter(self._get_job_type, parameterized_jobs), key=self._get_job_type)
aggregated_jobs_by_type = groupby(sorted_jobs_by_type, self._get_job_type)
nomad_pending_jobs_by_type, nomad_running_jobs_by_type = self._aggregate_nomad_jobs(aggregated_jobs_by_type)
// To get the total jobs for running and pending, the easiest