lockExternalDir: Lock external directory

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/lockExternalDir.R

Description

Lock the external Conda installation directory so that multiple processes cannot try to install at the same time.

Usage

1
2
3

Arguments

...

Further arguments to pass to lock, such as exclusive.

lock

An existing filelock_lock object.

Details

This will apply a lock to the (possibly user-specified) external Conda installation directory, so that a user trying to run parallel basilisk processes will not have race conditions during lazy Conda installation. We use filelock to manage the locking process for us, with the following strategy:

Note that locking is only required during installation of Conda (or its environments), not during actual use. Once an installation/environment is created, we assume that it is read-only for all processes. Technically, this might not be true if one were to install a new version of basilisk halfway through an R session, which would prompt installConda to wipe out the old Conda installations; but one cannot in general guarantee the behavior of running R sessions when package versions change anyway, so we won't bother to protect against that.

Value

lockExternalDir will return a filelock_lock object from lock.

unlockExternalDir will unlock the file and return NULL invisibly.

Author(s)

Aaron Lun

See Also

installConda, for an example of how to implement this locking approach.

Examples

1
2

basilisk.utils documentation built on Jan. 29, 2021, 2 a.m.