5 class TestJob(unittest.TestCase):
7 # The test passes no builder.resources
8 # Hence the default resources will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}
10 runner = mock.MagicMock()
11 runner.project_uuid = "zzzzz-8i9sb-zzzzzzzzzzzzzzz"
17 arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
18 arvtool.formatgraph = None
19 for j in arvtool.job({}, "", mock.MagicMock()):
21 runner.api.jobs().create.assert_called_with(body={
22 'owner_uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
23 'runtime_constraints': {},
24 'script_parameters': {
26 'task.env': {'TMPDIR': '$(task.tmpdir)'},
29 'crunchrunner': 'ff6fc71e593081ef9733afacaeee15ea+140/crunchrunner'
31 'script_version': 'master',
32 'minimum_script_version': '9e5b98e8f5f4727856b53447191f9c06e3da2ba6',
33 'repository': 'arvados',
34 'script': 'crunchrunner',
35 'runtime_constraints': {
36 'min_cores_per_node': 1,
37 'min_ram_mb_per_node': 1024,
38 'min_scratch_mb_per_node': 2048 # tmpdirSize + outdirSize
40 }, find_or_create=True)
42 # The test passes some fields in builder.resources
43 # For the remaining fields, the defaults will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}
44 def test_resource_requirements(self):
45 runner = mock.MagicMock()
46 runner.project_uuid = "zzzzz-8i9sb-zzzzzzzzzzzzzzz"
51 "class": "ResourceRequirement",
58 arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
59 arvtool.formatgraph = None
60 for j in arvtool.job({}, "", mock.MagicMock()):
62 runner.api.jobs().create.assert_called_with(body={
63 'owner_uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
64 'runtime_constraints': {},
65 'script_parameters': {
67 'task.env': {'TMPDIR': '$(task.tmpdir)'},
70 'crunchrunner': 'ff6fc71e593081ef9733afacaeee15ea+140/crunchrunner'
72 'script_version': 'master',
73 'minimum_script_version': '9e5b98e8f5f4727856b53447191f9c06e3da2ba6',
74 'repository': 'arvados',
75 'script': 'crunchrunner',
76 'runtime_constraints': {
77 'min_cores_per_node': 3,
78 'min_ram_mb_per_node': 3000,
79 'min_scratch_mb_per_node': 5024 # tmpdirSize + outdirSize
81 }, find_or_create=True)