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

try/catch/finally in download.py to avoid deadlock #1421

Merged
merged 1 commit into from
Jan 28, 2025
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: 8 additions & 7 deletions backend/compilers/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ def __init__(
def run(self):
while True:
try:
try:
item = self.download_queue.get_nowait()
except queue.Empty:
break
item = self.download_queue.get_nowait()
except queue.Empty:
break

try:
self.process_item(item)
self.download_queue.task_done()
except Exception as e:
logger.error("Exception thrown while processing item: %s", e)
break
finally:
self.download_queue.task_done()

def process_item(self, item):
platform_id, compiler_id = item
Expand Down Expand Up @@ -305,7 +306,7 @@ def main():
help="Name of github repo that owns the packages",
)
parser.add_argument(
"--threads", type=int, default=4, help="Number of download threads to use"
"--threads", type=int, default=8, help="Number of download threads to use"
)
parser.add_argument("--verbose", action="store_true", help="Enable DEBUG log level")
args = parser.parse_args()
Expand Down