Skip to content

Commit

Permalink
Consolidated parameter names for max submissions per worker
Browse files Browse the repository at this point in the history
  • Loading branch information
meta-paul committed Oct 26, 2023
1 parent de9e7ae commit ccd522c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions mephisto/data_model/task_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
6 changes: 3 additions & 3 deletions mephisto/data_model/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ccd522c

Please sign in to comment.