def DownloadJobResultsAsCsv(job_ids, only_differences, output_file): """Download the perf results of a job as a csv file.""" with open(output_file, 'wb') as f: writer = csv.writer(f) writer.writerow(('job_id', 'change', 'isolate') + histograms_df.COLUMNS) num_rows = 0 for job_id in job_ids: job = pinpoint_service.Job(job_id, with_state=True) os_path = _OsPathFromJob(job) results_file = os_path.join(job['arguments']['benchmark'], 'perf_results.json') print 'Fetching results for %s job %s:' % (job['status'].lower(), job_id) for change_id, isolate_hash in job_results.IterTestOutputIsolates( job, only_differences): print '- isolate: %s ...' % isolate_hash histograms = isolate_service.RetrieveFile( isolate_hash, results_file) for row in histograms_df.IterRows(json.loads(histograms)): writer.writerow((job_id, change_id, isolate_hash) + row) num_rows += 1 print 'Wrote data from %d histograms in %s.' % (num_rows, output_file)
def testJob_withState(self): self.assertEqual(pinpoint_service.Job('1234', with_state=True), 'OK') self.mock_request.assert_called_once_with( pinpoint_service.SERVICE_URL + '/job/1234', params=[('o', 'STATE')], use_auth=True)
def testJob(self): self.assertEqual(pinpoint_service.Job('1234'), 'OK') self.mock_request.assert_called_once_with( pinpoint_service.SERVICE_URL + '/job/1234', params=[], use_auth=True)
def CheckJobStatus(job_ids): for job_id in job_ids: job = pinpoint_service.Job(job_id) print '%s: %s' % (job_id, job['status'].lower())