From ccd522cd03c6f0199c14735f136f7ce3c95ec488 Mon Sep 17 00:00:00 2001 From: Paul Abumov Date: Wed, 25 Oct 2023 20:22:37 -0400 Subject: [PATCH] Consolidated parameter names for max submissions per worker --- mephisto/data_model/task_run.py | 10 ---------- mephisto/data_model/worker.py | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/mephisto/data_model/task_run.py b/mephisto/data_model/task_run.py index 75c761a9c..476cc917b 100644 --- a/mephisto/data_model/task_run.py +++ b/mephisto/data_model/task_run.py @@ -147,16 +147,6 @@ class TaskRunArgs: }, ) - max_submissions_per_worker: Optional[int] = field( - default=None, - metadata={ - "help": ( - "Maximum submissions that a worker can submit on across all " - "tasks that share this task_name. (0 is infinite)" - ) - }, - ) - @classmethod def get_mock_params(cls) -> str: """Returns a param string with default / mock arguments to use for testing""" diff --git a/mephisto/data_model/worker.py b/mephisto/data_model/worker.py index fc19d0744..6a27a7061 100644 --- a/mephisto/data_model/worker.py +++ b/mephisto/data_model/worker.py @@ -282,10 +282,10 @@ def is_eligible(self, task_run: "TaskRun") -> bool: def can_send_more_submissions_for_task(self, task_run: "TaskRun") -> bool: """Check whether a worker is allowed to send any more submissions within current Task""" - max_submissions_per_worker = task_run.args.max_submissions_per_worker + maximum_units_per_worker = task_run.args.task.maximum_units_per_worker # By default, worker can send any amount of submissions - if max_submissions_per_worker is None: + if maximum_units_per_worker == 0: return True # Find all completed units byt this worker for current task @@ -294,7 +294,7 @@ def can_send_more_submissions_for_task(self, task_run: "TaskRun") -> bool: u for u in task_units if u.get_status() in AssignmentState.completed() ] - if len(completed_task_units) >= max_submissions_per_worker: + if len(completed_task_units) >= maximum_units_per_worker: return False return True