Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ matrix:
- name: Check black formatting
python: 3.7
env: TOXENV=black
- name: Check flake8 on Python 2
python: 2.7
env: TOXENV=flake8
- name: Check flake8 on Python 3
python: 3.7
env: TOXENV=flake8
Expand Down
23 changes: 18 additions & 5 deletions faculty_distributed/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
from faculty import client


class JobOutputNotFoundError(Exception):
"""Raised when the output of a job has not been saved. This error is likely
to have been raised due to a failed job.
"""

pass


class FacultyJobExecutor:
"""
Run generic python function in parallel on Faculty Jobs
Expand Down Expand Up @@ -107,11 +115,16 @@ def _collect_output(self, args_sequence):
"""
out = []
for i in range(len(args_sequence)):
with open(
os.path.join(self.tmpdir, "output/out_{}.pkl".format(i)), "rb"
) as f:
out.append(cloudpickle.load(f))

filepath = os.path.join(self.tmpdir, "output/out_{}.pkl".format(i))
try:
with open(filepath, "rb",) as f:
out.append(cloudpickle.load(f))
except FileNotFoundError:
raise JobOutputNotFoundError(
"No such file: '{}'. This error is likely to have been "
"raised due to a failed job. Check the Jobs history for "
"further details.".format(filepath)
)
return out

def _make_dirs(self):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ commands =
[testenv:black]
skip_install = True
deps =
black==19.3b0
black==19.10b0
commands =
black {posargs:--check .}