Now all the MOOG running is located in ~/.pymoog/rundir, which make it impossible to run two MOOG in the same time since the seond running will remove all the files for the first run in that folder.
Inspired by Telfit (https://github.com/kgullikson88/Telluric-Fitter), it is better to have multiple rundir folders (e.g., rundir1, rundir2, rundi3, ...) when necessary and use a plain text file rundir1.lock to lock the corresponding folder to avoid conflict.
However this change will make it harder to check the input and output for MOOG after the program is done: the users do not know which rundir they should check and the lock will be remove once it is finished.
I am thinking of copying the whole folder into a new place (maybe ~/.pymoog/record/) and rename it using the driver name and time (e.g., abfind_20201203_105403/) when a new keyword is set (e.g., record=True).
Detail process:
Check which lock presents and find the smallest available rundir (e.g., if rundir2.lock and rundir3.lock presents, then the new run will use rundir1)
If the number of smallest available rundir is larger than a threshold (I would set 10), then raise an error and stop the code.
Create the folder lock
Create corredponding folder and/or remove all the contents in that folder
Prepare files and run MOOG
If there is error in MOOG, then it will be stopped and the folder lock remains.
Now all the MOOG running is located in ~/.pymoog/rundir, which make it impossible to run two MOOG in the same time since the seond running will remove all the files for the first run in that folder. Inspired by Telfit (https://github.com/kgullikson88/Telluric-Fitter), it is better to have multiple rundir folders (e.g., rundir1, rundir2, rundi3, ...) when necessary and use a plain text file rundir1.lock to lock the corresponding folder to avoid conflict.
However this change will make it harder to check the input and output for MOOG after the program is done: the users do not know which rundir they should check and the lock will be remove once it is finished. I am thinking of copying the whole folder into a new place (maybe ~/.pymoog/record/) and rename it using the driver name and time (e.g., abfind_20201203_105403/) when a new keyword is set (e.g., record=True).
Detail process: