diff --git a/iceprod/scheduled_tasks/update_task_priority.py b/iceprod/scheduled_tasks/update_task_priority.py index fe6be2ca..a289a193 100644 --- a/iceprod/scheduled_tasks/update_task_priority.py +++ b/iceprod/scheduled_tasks/update_task_priority.py @@ -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 = { diff --git a/iceprod/server/priority.py b/iceprod/server/priority.py index 7005464f..901596c8 100644 --- a/iceprod/server/priority.py +++ b/iceprod/server/priority.py @@ -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: