Skip to content

Commit 5e8a8e7

Browse files
authored
Improve AutoTST dependency handling in job execution (#816)
Replaces the import-time check for the AutoTST module with a runtime check for the configured AutoTST Python executable, providing a clearer error message if it is missing. Original code was attempting to import AutoTST scripts when in reality we use AutoTST as a subprocess, so it did not make sense to be importing the actual scripts.
2 parents 12e268a + 0c604e8 commit 5e8a8e7

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

arc/job/adapters/ts/autotst_ts.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
from arc.species.converter import xyz_from_data
2020
from arc.species.species import ARCSpecies, TSGuess, colliding_atoms
2121

22-
HAS_AUTOTST = True
23-
try:
24-
from autotst.reaction import Reaction as AutoTST_Reaction
25-
except (ImportError, ModuleNotFoundError):
26-
HAS_AUTOTST = False
27-
2822
if TYPE_CHECKING:
2923
from arc.level import Level
3024

@@ -218,9 +212,10 @@ def execute_incore(self):
218212
"""
219213
Execute a job incore.
220214
"""
221-
if not HAS_AUTOTST:
222-
raise ModuleNotFoundError(f'Could not import AutoTST, make sure it is properly installed.\n'
223-
f'See {self.url} for more information, or use the Makefile provided with ARC.')
215+
if not AUTOTST_PYTHON or not os.path.isfile(AUTOTST_PYTHON):
216+
raise FileNotFoundError('AutoTST python executable was not found. '
217+
'Make sure the tst_env exists and AUTOTST_PYTHON is configured. '
218+
f'See {self.url} for more information, or use the Makefile provided with ARC.')
224219
self._log_job_execution()
225220
self.initial_time = self.initial_time if self.initial_time else datetime.datetime.now()
226221

arc/species/converter_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4184,7 +4184,7 @@ def test_modify_coords(self):
41844184
new_xyz = converter.modify_coords(coords=xyz3, indices=indices, new_value=new_val,
41854185
modification_type=modification_type, mol=mol3)
41864186
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4187-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol3), new_val, 4)
4187+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol3), new_val, 3)
41884188

41894189
indices, new_val = [5, 2, 1], 160
41904190
expected_xyz = {'symbols': ('O', 'C', 'C', 'S', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'),

0 commit comments

Comments
 (0)