Skip to content

Commit 8809440

Browse files
author
Alan Christie
committed
fix: More work on the decoder
1 parent f3bbc6d commit 8809440

File tree

6 files changed

+65
-235
lines changed

6 files changed

+65
-235
lines changed

tests/test_decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_validate_schema_for_step_specification_variable_names():
142142
assert error is None
143143

144144

145-
@pytest.mark.skip(reason="DO not support combination atm")
145+
@pytest.mark.skip(reason="We do not support combination atm")
146146
def test_validate_schema_for_simple_python_parallel():
147147
# Arrange
148148

tests/test_workflow_engine_examples.py

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -208,37 +208,6 @@ def test_workflow_engine_example_smiles_to_file(basic_engine):
208208
assert project_file_exists(output_file)
209209

210210

211-
@pytest.mark.skip("Unrealistic test")
212-
def test_workflow_engine_shortcut_example_1(basic_engine):
213-
# Arrange
214-
md, da = basic_engine
215-
216-
# Make sure files that should be generated by the test
217-
# do not exist before we run the test.
218-
output_file_a = "a.sdf"
219-
assert not project_file_exists(output_file_a)
220-
output_file_b = "b.sdf"
221-
assert not project_file_exists(output_file_b)
222-
223-
# Act
224-
r_wfid = start_workflow(md, da, "shortcut-example-1", {})
225-
226-
# Assert
227-
wait_for_workflow(da, r_wfid)
228-
# Additional, detailed checks...
229-
# Check we only have one RunningWorkflowStep, and it succeeded
230-
response = da.get_running_workflow_steps(running_workflow_id=r_wfid)
231-
assert response["count"] == 2
232-
assert response["running_workflow_steps"][0]["done"]
233-
assert response["running_workflow_steps"][0]["success"]
234-
assert response["running_workflow_steps"][1]["done"]
235-
assert response["running_workflow_steps"][1]["success"]
236-
# This test should generate a file in the simulated project directory
237-
assert project_file_exists(output_file_a)
238-
assert project_file_exists(output_file_b)
239-
240-
241-
@pytest.mark.skip("temporary skip")
242211
def test_workflow_engine_simple_python_molprops(basic_engine):
243212
# Arrange
244213
md, da = basic_engine
@@ -249,13 +218,7 @@ def test_workflow_engine_simple_python_molprops(basic_engine):
249218
output="step1.out.smi",
250219
)
251220

252-
# Make sure files that should be generated by the test
253-
# do not exist before we run the test.
254-
output_file_1 = "step1.out.smi"
255-
assert not project_file_exists(output_file_1)
256-
output_file_2 = "step2.out.smi"
257-
assert not project_file_exists(output_file_2)
258-
# And create the test's input file.
221+
# Create the test's input file.
259222
input_file_1 = "input1.smi"
260223
input_file_1_content = """O=C(CSCc1ccc(Cl)s1)N1CCC(O)CC1
261224
RDKit 3D
@@ -307,9 +270,22 @@ def test_workflow_engine_simple_python_molprops(basic_engine):
307270
) as input_file:
308271
input_file.writelines(input_file_1_content)
309272

273+
# Make sure files that should be generated by the test
274+
# do not exist before we run the test.
275+
output_file_1 = "results.smi"
276+
assert not project_file_exists(output_file_1)
277+
output_file_2 = "clustered-results.smi"
278+
assert not project_file_exists(output_file_2)
279+
310280
# Act
311281
r_wfid = start_workflow(
312-
md, da, "simple-python-molprops", {"candidateMolecules": input_file_1}
282+
md,
283+
da,
284+
"simple-python-molprops",
285+
{
286+
"candidateMolecules": input_file_1,
287+
"clusteredMolecules": "clustered-results.smi",
288+
},
313289
)
314290

315291
# Assert
@@ -322,12 +298,10 @@ def test_workflow_engine_simple_python_molprops(basic_engine):
322298
assert response["running_workflow_steps"][0]["success"]
323299
assert response["running_workflow_steps"][1]["done"]
324300
assert response["running_workflow_steps"][1]["success"]
325-
# This test should generate a file in the simulated project directory
326-
assert project_file_exists(output_file_1)
301+
# This test should generate the expected file in the simulated project directory
327302
assert project_file_exists(output_file_2)
328303

329304

330-
@pytest.mark.skip("Unrealistic test")
331305
def test_workflow_engine_simple_python_molprops_with_options(basic_engine):
332306
# Arrange
333307
md, da = basic_engine
@@ -424,7 +398,6 @@ def test_workflow_engine_simple_python_molprops_with_options(basic_engine):
424398
assert project_file_exists(output_file_2)
425399

426400

427-
@pytest.mark.skip("Unrealistic test")
428401
def test_workflow_engine_simple_python_fanout(basic_engine):
429402
# Arrange
430403
md, da = basic_engine

tests/wapi_adapter.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ def get_running_workflow_step_by_name(
202202
for rwfs_id, record in running_workflow_step.items():
203203
if record["running_workflow"]["id"] != running_workflow_id:
204204
continue
205-
print("running wf step by name, record:", record)
206205
if record["name"] == name and record["replica"] == replica:
207206
response = record
208207
response["id"] = rwfs_id
@@ -425,11 +424,6 @@ def get_running_workflow_step_output_values_for_output(
425424
mock_output = Unpickler(pickle_file).load()
426425
UnitTestWorkflowAPIAdapter.lock.release()
427426

428-
print("mock output", mock_output)
429-
print("step", step)
430-
print("step_name", step_name)
431-
# mock output {'first-step': {'output_variable': 'results', 'output': ['chunk_1.smi', 'chunk_2.smi']}}
432-
433427
if step_name not in mock_output:
434428
return {"output": []}, 0
435429
# The record's output variable must match (there's only one record per step atm)

tests/workflow-definitions/simple-python-molprops.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ steps:
1414
variables:
1515
name: "col1"
1616
value: 123
17+
outputFile: "results.smi"
1718
variable-mapping:
1819
- variable: inputFile
1920
from-workflow:

workflow/decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ def get_step_prior_step_variable_mapping(
137137
# Tuple is "from" -> "to"
138138
if step_name in variable_mapping:
139139
variable_mapping[step_name].append(
140-
(v_map["variable"], step_variable)
140+
(step_variable, v_map["variable"])
141141
)
142142
else:
143-
variable_mapping[step_name] = [(v_map["variable"], step_variable)]
143+
variable_mapping[step_name] = [(step_variable, v_map["variable"])]
144144
return variable_mapping
145145

146146

0 commit comments

Comments
 (0)