def test_extend_current_args(self): job = AbstractJob() job.add_args("-i", File("f1"), "-o", File("f2")) job.add_args("-v", "-n5") assert job.args == ["-i", File("f1"), "-o", File("f2"), "-v", "-n5"]
def test_tojson(self): j = AbstractJob(_id="aj", node_label="test") j.set_stdin("stdin") j.set_stdout("stdout") j.set_stderr("stderr") j.add_args("-i", File("f1")) j.add_inputs(File("if1"), File("if2")) j.add_outputs(File("of1"), File("of2")) j.add_checkpoint(File("cpf")) result = json.loads(json.dumps(j, cls=_CustomEncoder)) result["uses"] = sorted(result["uses"], key=lambda use: use["lfn"]) expected = { "id": "aj", "nodeLabel": "test", "arguments": ["-i", "f1"], "stdin": "stdin", "stdout": "stdout", "stderr": "stderr", "uses": [ { "lfn": "stdin", "type": "input" }, { "lfn": "if1", "type": "input" }, { "lfn": "if2", "type": "input" }, { "lfn": "stdout", "type": "output", "stageOut": True, "registerReplica": False, }, { "lfn": "stderr", "type": "output", "stageOut": True, "registerReplica": False, }, { "lfn": "of1", "type": "output", "stageOut": True, "registerReplica": False, }, { "lfn": "of2", "type": "output", "stageOut": True, "registerReplica": False, }, { "lfn": "cpf", "type": "checkpoint", "stageOut": True, "registerReplica": False, }, ], } expected["uses"] = sorted(expected["uses"], key=lambda use: use["lfn"]) assert result == expected
def test_add_args(self): job = AbstractJob() job.add_args("-i", File("f1"), "-o", File("f2")) assert job.args == ["-i", File("f1"), "-o", File("f2")]