-class SummarizeJob(ReportDiff):
- fake_job_uuid = '4xphq-8i9sb-jq0ekny1xou3zoh'
- fake_log_id = 'fake-log-collection-id'
- fake_job = {
- 'uuid': fake_job_uuid,
- 'log': fake_log_id,
- }
- logfile = os.path.join(TESTS_DIR, 'logfile_20151204190335.txt.gz')
-
- @mock.patch('arvados.collection.CollectionReader')
- @mock.patch('arvados.api')
- def test_job_report(self, mock_api, mock_cr):
- mock_api().jobs().get().execute.return_value = self.fake_job
- mock_cr().__iter__.return_value = ['fake-logfile.txt']
- mock_cr().open.return_value = UTF8Decode(gzip.open(self.logfile))
- args = crunchstat_summary.command.ArgumentParser().parse_args(
- ['--job', self.fake_job_uuid])
- cmd = crunchstat_summary.command.Command(args)
- cmd.run()
- self.diff_known_report(self.logfile, cmd)
- mock_api().jobs().get.assert_called_with(uuid=self.fake_job_uuid)
- mock_cr.assert_called_with(self.fake_log_id)
- mock_cr().open.assert_called_with('fake-logfile.txt')
-
-
-class SummarizePipeline(ReportDiff):
- fake_instance = {
- 'uuid': 'zzzzz-d1hrv-i3e77t9z5y8j9cc',
- 'owner_uuid': 'zzzzz-tpzed-xurymjxw79nv3jz',
- 'components': collections.OrderedDict([
- ['foo', {
- 'job': {
- 'uuid': 'zzzzz-8i9sb-000000000000000',
- 'log': 'fake-log-pdh-0',
- 'runtime_constraints': {
- 'min_ram_mb_per_node': 900,
- 'min_cores_per_node': 1,
- },
- },
- }],
- ['bar', {
- 'job': {
- 'uuid': 'zzzzz-8i9sb-000000000000001',
- 'log': 'fake-log-pdh-1',
- 'runtime_constraints': {
- 'min_ram_mb_per_node': 900,
- 'min_cores_per_node': 1,
- },
- },
- }],
- ['no-job-assigned', {}],
- ['unfinished-job', {
- 'job': {
- 'uuid': 'zzzzz-8i9sb-xxxxxxxxxxxxxxx',
- },
- }],
- ['baz', {
- 'job': {
- 'uuid': 'zzzzz-8i9sb-000000000000002',
- 'log': 'fake-log-pdh-2',
- 'runtime_constraints': {
- 'min_ram_mb_per_node': 900,
- 'min_cores_per_node': 1,
- },
- },
- }]]),
- }