-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2a815d
commit 1555aa7
Showing
6 changed files
with
32 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,6 +320,27 @@ def helper(): | |
assert resource.spec == expected_rc_spec | ||
|
||
|
||
def test_job_definition_rc_single_line_command(sample_batch_step, compiler_env): | ||
command_str = textwrap.dedent("""\ | ||
commands: | | ||
echo one > ${outfile1} | ||
echo two > ${outfile2} | ||
echo three > ${outfile3} | ||
""") | ||
command_spec = yaml.safe_load(command_str) | ||
nu_sample_batch_step = sample_batch_step.copy() | ||
nu_sample_batch_step.update(**command_spec) | ||
step = Step("test_step", nu_sample_batch_step, "next_step") | ||
|
||
def helper(): | ||
_ = yield from job_definition_rc(step, "arn:task:role", "sh") | ||
|
||
for resource in helper(): | ||
result_spec = json.loads(resource.spec["Properties"]["spec"]) | ||
command = result_spec["parameters"]["command"] | ||
assert command == '["echo one > ${outfile1}\\necho two > ${outfile2}\\necho three > ${outfile3}\\n"]' | ||
|
||
|
||
@pytest.mark.parametrize("spec, expect", [ | ||
({}, "none"), | ||
({"skip_if_output_exists": True}, "output"), | ||
|
@@ -453,42 +474,6 @@ def helper(): | |
assert job_def_spec["containerProperties"]["jobRoleArn"] == expected_job_role_arn | ||
|
||
|
||
@pytest.mark.skip(reason="new qc_check") | ||
def test_handle_batch_with_qc(sample_batch_step, compiler_env): | ||
step = Step("step_name", sample_batch_step, "next_step_name") | ||
|
||
step.spec["qc_check"] = { | ||
"qc_result_file": "qc_file.json", | ||
"stop_early_if": "test_expression", | ||
"email_subject": "test subject", | ||
"notification": [ | ||
"[email protected]", | ||
"[email protected]", | ||
], | ||
} | ||
|
||
def helper(): | ||
states = yield from handle_batch(step, {"wf": "params", "versioned": "true"}, False) | ||
assert len(states) == 2 | ||
assert all(isinstance(s, State) for s in states) | ||
|
||
assert states[0].name == "step_name" | ||
assert states[0].spec["Resource"] == "arn:aws:states:::batch:submitJob.sync" | ||
assert states[0].spec["Parameters"]["JobDefinition"] == "${StepNameJobDefx}" | ||
assert states[0].spec["Next"] == "step_name.qc_checker" | ||
|
||
assert states[1].name == "step_name.qc_checker" | ||
assert states[1].spec["Next"] == "next_step_name" | ||
|
||
resource_gen = helper() | ||
resource_dict = dict(resource_gen) | ||
|
||
expected_keys = ["StepNameJobDefx"] | ||
assert list(resource_dict.keys()) == expected_keys | ||
|
||
assert resource_dict["StepNameJobDefx"]["Type"] == "Custom::BatchJobDefinition" | ||
|
||
|
||
def test_handle_batch_auto_inputs(sample_batch_step, compiler_env): | ||
step = Step("step_name", sample_batch_step, "next_step") | ||
step.spec["inputs"] = None | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.