Skip to content

Commit 66bcfaa

Browse files
committed
attempting to fix remaining errors showing up in GHA
1 parent 95759b7 commit 66bcfaa

File tree

8 files changed

+21
-95
lines changed

8 files changed

+21
-95
lines changed

.github/workflows/testpydra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080

8181
- name: Pytest
8282
run: |
83-
pytest -vs -n auto --doctest-modules \
83+
pytest -vs -n auto pydra --doctest-modules \
8484
--cov pydra --cov-config .coveragerc --cov-report xml:cov.xml
8585
8686
- name: Upload to codecov

.github/workflows/testslurm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
docker exec slurm bash -c "pip install --upgrade pip && pip install -e /pydra[test] && python -c 'import pydra.engine; print(pydra.engine.__version__)'"
5454
- name: Run pytest
5555
run: |
56-
docker exec slurm bash -c "pytest --color=yes -vs --cov pydra --cov-config /pydra/.coveragerc --cov-report xml:/pydra/cov.xml --doctest-modules /pydra/pydra/ -k 'not test_audit_prov and not test_audit_prov_messdir_1 and not test_audit_prov_messdir_2 and not test_audit_prov_wf and not test_audit_all'"
56+
docker exec slurm bash -c "pytest pydra/engine/tests/test_workflow.py pydra/engine/tests/test_submitter.py --color=yes -vs --cov pydra --cov-config /pydra/.coveragerc --cov-report xml:/pydra/cov.xml --doctest-modules /pydra/pydra/ -k 'not test_audit_prov and not test_audit_prov_messdir_1 and not test_audit_prov_messdir_2 and not test_audit_prov_wf and not test_audit_all'"
5757
- name: Upload to codecov
5858
run: |
5959
docker exec slurm bash -c "pip install urllib3==1.26.6"

new-docs/source/tutorial/4-python.ipynb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"source": [
2323
"from pydra.design import python\n",
2424
"\n",
25-
"# Note that we use CamelCase as the return of the is a class\n",
25+
"\n",
26+
"# Note that we use PascalCase because the object returned by the decorator is actually a class\n",
2627
"@python.define\n",
2728
"def MyFirstTaskDef(a, b):\n",
2829
" \"\"\"Sample function for testing\"\"\"\n",
@@ -72,6 +73,7 @@
7273
" \"\"\"Sample function for testing\"\"\"\n",
7374
" return a + b, a - b\n",
7475
"\n",
76+
"\n",
7577
"named_output_task = NamedOutputTaskDef(a=2, b=1)\n",
7678
"\n",
7779
"outputs = named_output_task()\n",
@@ -123,13 +125,13 @@
123125
"source": [
124126
"from pydra.design import python\n",
125127
"\n",
126-
"# Note that we use CamelCase as the function is translated to a class\n",
127128
"\n",
128129
"@python.define\n",
129130
"def MyTypedTask(a: int, b: float) -> float:\n",
130131
" \"\"\"Sample function for testing\"\"\"\n",
131132
" return a + b\n",
132133
"\n",
134+
"\n",
133135
"try:\n",
134136
" # 1.5 is not an integer so this should raise a TypeError\n",
135137
" my_typed_task = MyTypedTask(a=1.5, b=2.0)\n",
@@ -164,7 +166,8 @@
164166
"from pprint import pprint\n",
165167
"from pydra.engine.helpers import fields_dict\n",
166168
"\n",
167-
"@python.define\n",
169+
"\n",
170+
"@python.define(outputs=[\"c\", \"d\"])\n",
168171
"def DocStrDef(a: int, b: float) -> tuple[float, float]:\n",
169172
" \"\"\"Sample function for testing\n",
170173
"\n",
@@ -179,6 +182,7 @@
179182
" \"\"\"\n",
180183
" return a + b, a * b\n",
181184
"\n",
185+
"\n",
182186
"pprint(fields_dict(DocStrDef))\n",
183187
"pprint(fields_dict(DocStrDef.Outputs))"
184188
]

new-docs/source/tutorial/tst.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

pydra/engine/specs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,16 @@ def __call__(
294294
)
295295
raise
296296
if result.errored:
297+
if result.errors:
298+
time_of_crash = result.errors["time of crash"]
299+
error_message = "\n".join(result.errors["error message"])
300+
else:
301+
time_of_crash = "UNKNOWN"
302+
error_message = "NOT RETRIEVED"
297303
raise RuntimeError(
298-
f"Task {self} failed @ {result.errors['time of crash']} with the "
304+
f"Task {self} failed @ {time_of_crash} with the "
299305
"following errors:\n"
300-
+ "\n".join(result.errors["error message"])
306+
+ "\n".join(error_message)
301307
+ (
302308
"To inspect, please load the pickled task object from here: "
303309
f"{result.output_dir}/_task.pklz"

pydra/engine/submitter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,7 @@ def get_runnable_tasks(self, graph: DiGraph) -> list["Task[DefType]"]:
818818
break
819819
if is_runnable:
820820
runnable.append(self.blocked.pop(index))
821-
self.queued.update({t.state_index: t for t in runnable})
822-
return list(self.queued.values())
821+
return runnable
823822

824823

825824
async def prepare_runnable(runnable):

pydra/engine/tests/test_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,9 @@ def PassOdds(x):
13951395
pass_odds = PassOdds().split("x", x=[1, 2, 3, 4, 5])
13961396

13971397
with pytest.raises(Exception):
1398-
pass_odds(cache_dir=tmp_path, worker="cf")
1398+
pass_odds(cache_dir=tmp_path, worker="cf", n_procs=3)
13991399
with pytest.raises(Exception):
1400-
pass_odds(cache_dir=tmp_path, worker="cf")
1400+
pass_odds(cache_dir=tmp_path, worker="cf", n_procs=3)
14011401

14021402
out, err = capfd.readouterr()
14031403
stdout_lines = out.splitlines()

pydra/engine/tests/test_workflow.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4467,14 +4467,11 @@ def test_rerun_errored(plugin_parallel, tmp_path, capfd):
44674467
"""Test rerunning a workflow containing errors.
44684468
Only the errored tasks and workflow should be rerun"""
44694469

4470-
class EvenException(Exception):
4471-
pass
4472-
44734470
@python.define
44744471
def PassOdds(x):
44754472
if x % 2 == 0:
44764473
print(f"x={x}, running x%2 = {x % 2} (even error)\n")
4477-
raise EvenException("even error")
4474+
raise ValueError("even error")
44784475
else:
44794476
print(f"x={x}, running x%2 = {x % 2}\n")
44804477
return x
@@ -4498,9 +4495,6 @@ def WorkyPassOdds(x):
44984495
out, err = capfd.readouterr()
44994496
stdout_lines = out.splitlines()
45004497

4501-
with open("/Users/tclose/Desktop/pytest-stdout.txt", "w") as f:
4502-
f.write(out)
4503-
45044498
tasks_run = 0
45054499
errors_found = 0
45064500

0 commit comments

Comments
 (0)