Skip to content

Commit

Permalink
fix prio bug (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsschult authored Dec 24, 2024
1 parent a3789e4 commit 3d4e416
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion iceprod/scheduled_tasks/update_task_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ async def run(rest_client, dataset_id=None, status=None, debug=False):
status (list): list of task statuses to update
debug (bool): debug flag to propagate exceptions
"""
assert status
if not status:
status = ['idle', 'waiting']
prio = Priority(rest_client)
try:
args = {
Expand Down
8 changes: 4 additions & 4 deletions iceprod/server/priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ async def get_task_prio(self, dataset_id, task_id):
tasks_per_job = dataset['tasks_submitted'] / dataset['jobs_submitted']

# bias towards finishing jobs
priority += (1. * task['task_index'] / tasks_per_job) / 10.
priority += (1. * task['task_index'] / tasks_per_job) / 5.
logger.info(f'{dataset_id}.{task_id} after finishing jobs adjustment: {priority}')

# bias towards first jobs in dataset
priority += (1. * (dataset['jobs_submitted'] - task['job_index']) / dataset['jobs_submitted']) / 100.
logger.info(f'{dataset_id}.{task_id} after first jobs adjustment: {priority}')
# spread out job priorities to allow dataset balancing
priority -= (1. - (dataset['jobs_submitted'] - task['job_index']) / dataset['jobs_submitted']) / 5.
logger.info(f'{dataset_id}.{task_id} after job index adjustment: {priority}')

# boost towards first 100 jobs (or small datasets)
if task['job_index'] < 100:
Expand Down

0 comments on commit 3d4e416

Please sign in to comment.