Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch BlockingIOError in job_server. #599

Merged
merged 1 commit into from
Feb 25, 2020
Merged
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
15 changes: 5 additions & 10 deletions catkin_tools/execution/job_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from termios import FIONREAD

import array
import errno
import fcntl
import os
import re
Expand Down Expand Up @@ -162,9 +161,8 @@ def _set_max_jobs(cls, max_jobs):
# Read all possible tokens from the pipe
try:
os.read(cls._job_pipe[0], cls._max_jobs)
except OSError as e:
if e.errno != errno.EINTR:
raise
except (BlockingIOError, InterruptedError):
pass
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these derive from OSError. Any other OSError exceptions will raise through, as the behaviour was before.


# Update max jobs
cls._max_jobs = max_jobs
Expand Down Expand Up @@ -259,9 +257,8 @@ def _acquire(cls):
# read a token from the job pipe
token = os.read(cls._job_pipe[0], 1)
return token
except OSError as e:
if e.errno != errno.EINTR:
raise
except (BlockingIOError, InterruptedError):
pass

return None

Expand All @@ -279,9 +276,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):
pass

return cls._max_jobs
Expand Down