mlr-org / mlr-org/batchtools

ROBUSTNESS: Are JobCollection objects written atomically?

Open
#80 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Vignette 'Migrating from BatchJobs/BatchExperiments' says:

  • "Nodes do not have to access the registry. submitJobs() stores a temporary object of type JobCollection on the file system which holds all the information necessary to execute a chunk of jobs via doJobCollection() on the node. This avoids file system locks because each job accesses only one file exclusively."

What happens if master reads such a JobConnection file before it has been fully written? Sure, the chance for this should be small, but with 10,000-100,000's of jobs, could this happen? If it could happen, I wonder if the file format can protect against this, e.g. an generate at least a parse error, or in the worst case, silently parse the incomplete file.

If not already written atomically, could it be achieved by simply writing to foo.rds.tmp which is then renamed to foo.rds only when saveRDS() is complete? (Here I'm just assuming you're using RDS files).

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 “Migrating from BatchJobs/BatchExperiments” vignette and trace submitJobs() and doJobCollection(). Inspect how JobCollection files are written and read, and determine whether a concurrent read can observe incomplete data. Done means the atomicity behavior is documented and, if needed, protected by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.