About locking in EDM¶
EDM uses strategic locking to help prevent multiple overlapping uses of EDM from causing problems, such as corrupting an environment, the runtime and egg caches, or other local data created or manipulated by EDM.
The global lock¶
Most EDM commands will first aquire a global lock before performing their designated functionality. If another invocation of EDM has already acquired the lock then EDM will report that it is unable to acquire the lock and will try again in a few seconds. For example:
$ edm env list Unable to lock the database. If you're sure EDM is not already running, you can remove the directory /Users/USERNAME/.edm/global.lock Retrying for 30s ...
As shown in the message above, the environment is locked by creating a folder in the root of the EDM home directory, which will contain a file with the ID of the process holding the lock. If a prior invocation of EDM crashed or had some other problem then the lock can be manually removed by simply removing the global.lock folder.
Setting EDM to be read-only¶
If an EDM installation and environments will be shared by multiple users, then it can be useful to set EDM to a read-only state. This will prevent any operations that would try to acquire the global lock. It is also possible to set a read-only EDM back to read-write before performing maintenance such as updating packages or installing new environments.
The basic workflow when employing a read-only EDM may be something like this:
An administrator installs EDM and sets up one or more EDM Python environments.
The Administrator marks EDM as read-only (see example below.)
Non-admin users are then free to use the Python environments, but will be unable to make any changes using EDM themselves.
When changes are needed, the administrator can set EDM back into read-write mode, make the needed changes, and then change back to read-only mode again.
Note that it is also advised that the operating system’s user or group permissions be used to allow only an administrator to have write access to the EDM home directory tree.
Setting EDM to read-only mode can be done like this:
$ edm mark-read-only
Setting back to read-write mode can be done like this:
$ edm mark-read-write
set-read-write command does not alter the operating system’s file
access permissions, so the administrator will need to ensure that they have
write permissions to the EDM root directory tree to actually be able to make