def report(self, completion_result, disk_bytes): """ Convert the k8s-specific completion result into a report and submit it :param completion_result: calrissian.k8s.CompletionResult """ report = TimedResourceReport.create(self.name, completion_result, disk_bytes) Reporter.add_report(report)
def test_create(self): completion_result = CompletionResult(0, '4', '3G', TIME_1000, TIME_1100) name = 'test-job' disk_bytes = 10000000 report = TimedResourceReport.create(name, completion_result, disk_bytes) self.assertEqual(report.cpu_hours(), 4) self.assertEqual(report.ram_megabyte_hours(), 3000) self.assertEqual(report.start_time, TIME_1000) self.assertEqual(report.finish_time, TIME_1100) self.assertEqual(report.name, 'test-job') self.assertEqual(report.disk_megabytes, 10)