Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution order of jobs in the same chunk #272

Open
bommert opened this issue Apr 9, 2021 · 0 comments
Open

Execution order of jobs in the same chunk #272

bommert opened this issue Apr 9, 2021 · 0 comments

Comments

@bommert
Copy link

bommert commented Apr 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant