Skip to content

Commit 0545ac7

Browse files
committed
Directory might already exist when run in parallel
1 parent 0810fbc commit 0545ac7

4 files changed

Lines changed: 32 additions & 31 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ideas
1919
projects
2020
pkl
2121
tmp
22+
tmp*
2223
tox.ini
2324

2425
build

src/moldrug/constraintconf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def generate_conformers(mol: Chem.rdchem.Mol,
162162
"""
163163
# Creating the error directory if needed
164164
if not os.path.isdir('error'):
165-
os.makedirs('error')
165+
os.makedirs('error', exist_ok=True)
166166
# if SMILES to be fixed are not given, assume to the MCS
167167
if ref_smi:
168168
if not Chem.MolFromSmiles(ref_smi):

src/moldrug/fitness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def _vinadock(
311311

312312
# Creating the error directory if needed
313313
if not os.path.isdir('error'):
314-
os.makedirs('error')
314+
os.makedirs('error', exist_ok=True)
315315
# Creating the working directory if needed
316316
if not os.path.exists(wd):
317317
os.makedirs(wd)

tests/test_moldrug.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -106,35 +106,35 @@ def test_single_receptor_command_line():
106106
}
107107
}
108108

109-
# if execution_mode == "multiprocessing":
110-
# pass
111-
# elif execution_mode in ["smaug", "elwe"]:
112-
# assert dask_available
113-
114-
# if execution_mode == "smaug":
115-
# Config['01_grow']['cluster'] = {
116-
# "SLURMCluster_kwargs": {
117-
# "queue": "short",
118-
# "cores": 12,
119-
# "processes": 1,
120-
# "memory": "8GB",
121-
# "walltime": "00:15:00",
122-
# "job_extra_directives": ["--gpus 1"]
123-
# }
124-
# }
125-
# elif execution_mode == "elwe":
126-
# Config['01_grow']['cluster'] = {
127-
# "SLURMCluster_kwargs": {
128-
# "queue": "uds-hub",
129-
# "cores": 10,
130-
# "processes": 1,
131-
# "memory": "8GB",
132-
# "walltime": "00:15:00",
133-
# "job_extra_directives": ["--gpus 1"]
134-
# }
135-
# }
136-
# else:
137-
# raise ValueError(f"Unknown mode {execution_mode}")
109+
if execution_mode == "multiprocessing":
110+
pass
111+
elif execution_mode in ["smaug", "elwe"]:
112+
assert dask_available
113+
114+
if execution_mode == "smaug":
115+
Config['01_grow']['cluster'] = {
116+
"SLURMCluster_kwargs": {
117+
"queue": "short",
118+
"cores": 12,
119+
"processes": 1,
120+
"memory": "8GB",
121+
"walltime": "00:15:00",
122+
"job_extra_directives": ["--gpus 1"]
123+
}
124+
}
125+
elif execution_mode == "elwe":
126+
Config['01_grow']['cluster'] = {
127+
"SLURMCluster_kwargs": {
128+
"queue": "uds-hub",
129+
"cores": 10,
130+
"processes": 1,
131+
"memory": "8GB",
132+
"walltime": "00:15:00",
133+
"job_extra_directives": ["--gpus 1"]
134+
}
135+
}
136+
else:
137+
raise ValueError(f"Unknown mode {execution_mode}")
138138

139139
with open("test_single_receptor.yml", 'w') as c:
140140
yaml.dump(Config, c)

0 commit comments

Comments
 (0)