Repository navigation
Fix a divergent partition function shipping as a rate coefficient, plus restart, submission and AutoTST fixes #1069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alongd
wants to merge
13
commits into
main
Choose a base branch
from
paper-demo-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,099
−61
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ae2789d
arkane: discard kinetics computed from a near-zero vibrational frequency
alongd 08c6a3a
plotter: decide the "No rotors considered" TS note from the rotor data
alongd 21b7cea
scheduler: skip IRC endpoint rotors on restart
alongd 84e55d3
scheduler: restart rotors that were never scanned
alongd 345f05d
scheduler: allow rotor scans before the pipe planner exists
alongd 78d7932
scheduler: drop superseded conf_opt jobs when respawning TS conformers
alongd d69f77d
scheduler: skip restored jobs of species missing from the project
alongd c4b830b
scheduler: skip untracked conformer jobs when saving the restart file
alongd 98eab88
ssh: report an unparsable job ID from a known scheduler as an errored…
alongd 1fd6f69
ssh: retry a submission refused by a full PBS queue, once, and keep i…
alongd 1665481
autotst: exit non-zero with a traceback when AutoTST fails
alongd f7b8012
autotst: run the AutoTST subprocess without the caller's PYTHONPATH
alongd 3a5f359
autotst installer: register AutoTST with a .pth file in tst_env inste…
alongd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #!/usr/bin/env python3 | ||
| # encoding: utf-8 | ||
|
|
||
| """ | ||
| Unit tests for ``arc.job.adapters.scripts.autotst_script``. | ||
|
|
||
| The script runs inside ``tst_env``, where AutoTST is importable. These tests run it in ARC's own | ||
| interpreter against a stub ``autotst`` package, so they exercise the script's exit contract | ||
| without AutoTST installed. | ||
| """ | ||
|
|
||
| import os | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| import unittest | ||
|
|
||
| from arc.common import ARC_PATH | ||
|
|
||
| SCRIPT_PATH = os.path.join(ARC_PATH, 'arc', 'job', 'adapters', 'scripts', 'autotst_script.py') | ||
|
|
||
| STUB_REACTION_MODULE = ''' | ||
| class Reaction(object): | ||
| """A stand-in for autotst.reaction.Reaction that fails the way a broken AutoTST setup does.""" | ||
| def __init__(self, label): | ||
| self.label = label | ||
|
|
||
| def get_labeled_reaction(self): | ||
| raise RuntimeError('stub AutoTST could not label the reaction') | ||
| ''' | ||
|
|
||
|
|
||
| class TestAutoTSTScriptFailure(unittest.TestCase): | ||
| """A failure inside AutoTST must reach ARC as a non-zero exit with a traceback.""" | ||
|
|
||
| def setUp(self): | ||
| self.tmp_dir = tempfile.mkdtemp(prefix='test_autotst_script_') | ||
| self.addCleanup(shutil.rmtree, self.tmp_dir, ignore_errors=True) | ||
| stub_dir = os.path.join(self.tmp_dir, 'stub', 'autotst') | ||
| os.makedirs(stub_dir) | ||
| with open(os.path.join(stub_dir, '__init__.py'), 'w') as f: | ||
| f.write('') | ||
| with open(os.path.join(stub_dir, 'reaction.py'), 'w') as f: | ||
| f.write(STUB_REACTION_MODULE) | ||
| self.output_path = os.path.join(self.tmp_dir, 'out', 'ts_results.yml') | ||
|
|
||
| def run_script(self) -> subprocess.CompletedProcess: | ||
| """Run the script against the stub AutoTST package.""" | ||
| env = dict(os.environ, PYTHONPATH=os.path.join(self.tmp_dir, 'stub')) | ||
| return subprocess.run([sys.executable, SCRIPT_PATH, 'C+[OH]_[CH3]+O', self.output_path], | ||
| capture_output=True, text=True, env=env, timeout=120) | ||
|
|
||
| def test_autotst_failure_exits_non_zero_with_a_traceback(self): | ||
| """A bare `return None` exits 0 and reads as "AutoTST found no TS" instead of an error.""" | ||
| result = self.run_script() | ||
| self.assertNotEqual(result.returncode, 0) | ||
| self.assertIn('Traceback', result.stderr) | ||
| self.assertIn('stub AutoTST could not label the reaction', result.stderr) | ||
| self.assertFalse(os.path.isfile(self.output_path)) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main(testRunner=unittest.TextTestRunner(verbosity=2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env python3 | ||
| # encoding: utf-8 | ||
|
|
||
| """ | ||
| Unit tests for the AutoTST TS-search adapter, with the tst_env subprocess boundary mocked. | ||
| """ | ||
|
|
||
| import os | ||
| import shutil | ||
| import subprocess | ||
| import tempfile | ||
| import unittest | ||
| import unittest.mock | ||
|
|
||
| import arc.job.adapters.ts.autotst_ts as autotst_ts | ||
| from arc.reaction import ARCReaction | ||
| from arc.species import ARCSpecies | ||
|
|
||
|
|
||
| class TestAutoTSTAdapter(unittest.TestCase): | ||
| """Contains unit tests for the AutoTSTAdapter class.""" | ||
|
|
||
| def setUp(self): | ||
| self.project_directory = tempfile.mkdtemp(prefix='test_AutoTST_') | ||
| self.addCleanup(shutil.rmtree, self.project_directory, ignore_errors=True) | ||
| self.rxn = ARCReaction(r_species=[ARCSpecies(label='CH4', smiles='C'), ARCSpecies(label='OH', smiles='[OH]')], | ||
| p_species=[ARCSpecies(label='CH3', smiles='[CH3]'), ARCSpecies(label='H2O', smiles='O')]) | ||
|
|
||
| def test_autotst_runs_without_the_callers_pythonpath(self): | ||
| """tst_env's own rmgpy must not be shadowed by a source checkout on ARC's PYTHONPATH.""" | ||
| self.assertEqual(self.rxn.family, 'H_Abstraction') | ||
| adapter = autotst_ts.AutoTSTAdapter(job_type='tsg', | ||
| reactions=[self.rxn], | ||
| testing=True, | ||
| project='test', | ||
| project_directory=self.project_directory, | ||
| ) | ||
| calls = list() | ||
|
|
||
| def fake_run_in_conda_env(python_executable, script_path, *script_args, check=False, | ||
| strip_pythonpath=False): | ||
| """Record the call and report an AutoTST run that found nothing.""" | ||
| calls.append({'script_path': script_path, 'script_args': script_args, | ||
| 'strip_pythonpath': strip_pythonpath}) | ||
| return subprocess.CompletedProcess(args=[], returncode=0, stdout='', stderr='') | ||
|
|
||
| with unittest.mock.patch.object(autotst_ts, 'AUTOTST_PYTHON', autotst_ts.__file__), \ | ||
| unittest.mock.patch.object(autotst_ts, 'run_in_conda_env', side_effect=fake_run_in_conda_env): | ||
| adapter.execute_incore() | ||
|
|
||
| self.assertEqual(len(calls), 2) # forward and reverse | ||
| for call in calls: | ||
| self.assertTrue(call['script_path'].endswith(os.path.join('scripts', 'autotst_script.py'))) | ||
| self.assertTrue(call['strip_pythonpath']) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main(testRunner=unittest.TextTestRunner(verbosity=2)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.