Skip to content

Commit

Permalink
Catch BlockingIOError in job_server.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepurvis committed Feb 25, 2020
1 parent 8f6add4 commit 2b3860b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions catkin_tools/execution/job_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def _set_max_jobs(cls, max_jobs):
except OSError as e:
if e.errno != errno.EINTR:
raise
except BlockingIOError:
pass

# Update max jobs
cls._max_jobs = max_jobs
Expand Down Expand Up @@ -259,6 +261,8 @@ def _acquire(cls):
# read a token from the job pipe
token = os.read(cls._job_pipe[0], 1)
return token
except BlockingIOError:
pass
except OSError as e:
if e.errno != errno.EINTR:
raise
Expand All @@ -279,9 +283,7 @@ def _running_jobs(cls):
buf = array.array('i', [0])
if fcntl.ioctl(cls._job_pipe[0], FIONREAD, buf) == 0:
return cls._max_jobs - buf[0]
except NotImplementedError:
pass
except OSError:
except (NotImplementedError, OSError, BlockingIOError):
pass

return cls._max_jobs
Expand Down

0 comments on commit 2b3860b

Please sign in to comment.