Skip to content

Commit

Permalink
Make task chunks more evenly sized.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleGower committed Feb 22, 2023
1 parent 14ca26c commit 89f8ddc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-38101.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modifying PanDA task chunking to be evenly divided.
9 changes: 7 additions & 2 deletions python/lsst/ctrl/bps/panda/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,14 @@ def add_idds_work(config, generic_workflow, idds_workflow):
job_count = 0 # Number of jobs in idds task used for task chunking
task_chunk = 1 # Task chunk number within job label used for unique name
work = None
for gwjob in generic_workflow.get_jobs_by_label(job_label):
jobs_by_label = generic_workflow.get_jobs_by_label(job_label)
num_chunks = -(-len(jobs_by_label) // max_jobs_per_task) # ceil
max_jobs_per_task_this_label = -(-len(jobs_by_label) // num_chunks)
_LOG.debug("For job_label = %s, num jobs = %s, num_chunks = %s, max_jobs = %s",
job_label, len(jobs_by_label), num_chunks, max_jobs_per_task_this_label)
for gwjob in jobs_by_label:
job_count += 1
if job_count >= max_jobs_per_task:
if job_count > max_jobs_per_task_this_label:
job_count = 1
task_chunk += 1

Expand Down

0 comments on commit 89f8ddc

Please sign in to comment.