From b88fb862a4dc71e55e5366520cb289eaca203373 Mon Sep 17 00:00:00 2001 From: Ranald Lam Date: Fri, 25 Jun 2021 14:41:53 +0800 Subject: [PATCH] Support more than 100 workers --- cms/grading/Sandbox.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cms/grading/Sandbox.py b/cms/grading/Sandbox.py index 741b68dad7..f1d9c581b1 100644 --- a/cms/grading/Sandbox.py +++ b/cms/grading/Sandbox.py @@ -865,8 +865,14 @@ def __init__(self, file_cacher, name=None, temp_dir=None): # sequentially, with a wrap-around. # FIXME This is the only use of FileCacher.service, and it's an # improper use! Avoid it! + + # IOI 2021 Hack for more than 100 workers: + # shard 0 = 10 - 19 + # shard 98 = 990 - 999 + # shard 99 = shard 0 + if file_cacher is not None and file_cacher.service is not None: - box_id = ((file_cacher.service.shard + 1) * 10 + box_id = (((file_cacher.service.shard % 99) + 1) * 10 + (IsolateSandbox.next_id % 10)) % 1000 else: box_id = IsolateSandbox.next_id % 10