daquinterop / Py_DSSATTools

A Python library for crop modeling using DSSAT
GNU General Public License v3.0
52 stars 18 forks source link

Create unique temporary directories #45

Open braza2 opened 4 hours ago

braza2 commented 4 hours ago

issue: Running parallel sessions leads to race conditions where each session tries to access or write to f"/tmp/DSSAT{VERSION}".

Replace line 50 in run.py https://github.com/daquinterop/Py_DSSATTools/blob/c9d9e1433cd822616394f7d4f0df426381d49cc2/DSSATTools/run.py#L50

which creates the folder /tmp/ with

with tempfile.TemporaryDirectory() as TMP:
    print('created temporary directory', TMP)

each session now creates a unique temporary folder, thus solving the issue.

braza2 commented 4 hours ago

Note: parallel session defined as running array jobs on a cluster with slurm.