Functions that indicate whether a model folder is currently locked by
another process or not. This helps to prevent unintended interactions
between processes.
model_lock returns the process id which is needed (only on Windows)
to identify the process in model_unlock.
Arguments
folder
model folder
file
file name of the lock file containing the process queue
timeout1
Time in hours the top process in the queue is allowed to run
before the current process is stopped.
timeout2
Time in hours the processed is allowed to wait in the queue
before it is stopped
check_interval
Time in seconds between checking the current position
in the queue.
oncluster
a logical indicating whether the script is run on cluster
or not. On windows a lock file is created, which does not prevent
simulatneous access to the model. On the cluster the system command 'mkdir'
is used to prevent simultaneous access. This atomicity of check-and-create
is ensured at the operating system kernel level.