mlr-org / mlr-org/batchtools

Execution order of jobs in the same chunk

Open
#272 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
184
Forks
53
Avg merge
7d 2h
Merged PRs (30d)
1

Description

Question: Can I control the execution order of jobs in the same chunk?

The situation is that I have a registry with many jobs and I want to use chunking. Some of the jobs are really fast, others are quite slow. I have more or less accurate run time estimates. I would like the jobs within one chunk to be executed such that the slowest job is executed first and the fastest is executed last. The idea is that if the batch job runs into the walltime, it would be nice to stop while executing a rather fast job (and thus waste less computational resources). Is there any way to control the execution order within one chunk?

On my local computer I have tried (with cluster function interactive) the following code:

makeRegistry("testReg")
f = function(i) {
  Sys.sleep(10)
  return(Sys.time())
}
batchMap(i = 1:4, fun = f)

jobs = data.frame(job.id = 4:1, chunk = c(1, 2, 1, 2))
submitJobs(jobs)

jobs
  job.id chunk
1      4     1
2      3     2
3      2     1
4      1     2

reduceResultsDataTable(findDone())
   job.id              result
1:      1 2021-04-09 12:55:19
2:      2 2021-04-09 12:54:59
3:      3 2021-04-09 12:55:29
4:      4 2021-04-09 12:55:09

So it seems that chunk 1 is executed before chunk 2 but within one chunk, the jobs are executed sorted by job.id, even though I passed them to submitJobs in a different order.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the submitJobs entry point and reproduce the provided makeRegistry, batchMap, and submitJobs example using the recorded jobs data frame. Trace how chunks and job IDs are ordered, then determine whether the requested within-chunk ordering is supported; done means the behavior or limitation is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
hpc, r
Domain
distributed-systems, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.