-
Notifications
You must be signed in to change notification settings - Fork 9
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
Parallel + DB Locking Issue #322
Comments
Very interesting use-case. I do not see how this can be solved for SQLite. The best solution is to use a more advanced database, like postgress. Try createPostgresRepo() and setPostgresRepo(). Postgress will handle concurrent access to a single database. |
Hi, I was dealing with the similar issue and my solution was to create save_to_repo_extended using package save_to_repo_extended <- function(artifact,
repoDir = archivist::aoptions("repoDir"),
archiveData = TRUE,
archiveTags = TRUE,
archiveMiniature = TRUE,
archiveSessionInfo = TRUE,
force = TRUE, value = FALSE,
...,
userTags = c(),
silent = archivist::aoptions("silent"),
ascii = FALSE,
artifactName = deparse(substitute(artifact)),
file_lock = NULL){ # passing the file lock
if(is.null(file_lock)){ # if lock does not exists continue as usual
return_value <- archivist::saveToRepo(artifact, repoDir, archiveData, archiveTags,
archiveMiniature, archiveSessionInfo, force,
value, ..., userTags, silent, ascii, artifactName)
} else { # lock exists -> lock section and continue
locker <- flock::lock(file_lock) # lock critical section
return_value <- archivist::saveToRepo(artifact, repoDir, archiveData, archiveTags,
archiveMiniature, archiveSessionInfo, force,
value, ..., userTags, silent, ascii, artifactName)
flock::unlock(locker) # unlock section
}
return_value
} |
thanks, will try later. |
Thank you guys for this interesting use case. |
Hi,
I have a regular batch job to save articrafts to local repo. And I was using mcparallel to do it.
However, one of the task failed which shows:
What type of parallel process should I use to avoid DB locking issue?
The text was updated successfully, but these errors were encountered: