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()
16 arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
17 arvtool.formatgraph = None
18 for j in arvtool.job({}, "", mock.MagicMock()):
20 runner.api.jobs().create.assert_called_with(body={
21 'runtime_constraints': {},
22 'script_parameters': {
24 'task.env': {'TMPDIR': '$(task.tmpdir)'},
27 'crunchrunner': '83db29f08544e1c319572a6bd971088a+140/crunchrunner'
29 'script_version': 'master',
30 'minimum_script_version': '9e5b98e8f5f4727856b53447191f9c06e3da2ba6',
31 'repository': 'arvados',
32 'script': 'crunchrunner',
33 'runtime_constraints': {
34 'min_cores_per_node': 1,
35 'min_ram_mb_per_node': 1024,
36 'min_scratch_mb_per_node': 2048 # tmpdirSize + outdirSize
38 }, find_or_create=True)
40 # The test passes some fields in builder.resources
41 # For the remaining fields, the defaults will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}
42 def test_resource_requirements(self):
43 runner = mock.MagicMock()
48 "class": "ResourceRequirement",
55 arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
56 arvtool.formatgraph = None
57 for j in arvtool.job({}, "", mock.MagicMock()):
59 runner.api.jobs().create.assert_called_with(body={
60 'runtime_constraints': {},
61 'script_parameters': {
63 'task.env': {'TMPDIR': '$(task.tmpdir)'},
66 'crunchrunner': '83db29f08544e1c319572a6bd971088a+140/crunchrunner'
68 'script_version': 'master',
69 'minimum_script_version': '9e5b98e8f5f4727856b53447191f9c06e3da2ba6',
70 'repository': 'arvados',
71 'script': 'crunchrunner',
72 'runtime_constraints': {
73 'min_cores_per_node': 3,
74 'min_ram_mb_per_node': 3000,
75 'min_scratch_mb_per_node': 5024 # tmpdirSize + outdirSize
77 }, find_or_create=True)