Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/resources/significantly_different.py

Issue 2247373002: Refactor stages 1, 2 and test_api overhaul. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Rebasing, addressing feedback. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 """Launches an anaconda environment to run some scipy hypothesis tests."""
2
3 import json
4 import os
5 import subprocess
6 import sys
7
8 class ScipyNotInstalledError(Exception):
9 pass
10
11 def main(argv, anaconda_path=None):
12 _, list_a, list_b, significance = argv
13
14 # Do not even test if there's a single repeated value on both samples.
15 if len(set(json.loads(list_a) + json.loads(list_b))) == 1:
16 return {
17 'first_sample': json.loads(list_a),
18 'second_sample': json.loads(list_b),
19 'mann_p_value': None,
20 'significantly_different': False
21 }
22
23 if not anaconda_path:
24 if os.name == 'nt':
25 anaconda_path = r'c:\conda-py-scientific\python.exe'
26 else:
27 anaconda_path = '/opt/conda-py-scientific/bin/python'
28 if not os.path.exists(anaconda_path):
29 raise ScipyNotInstalledError()
30
31 inner_script_location = os.path.join(os.path.dirname(os.path.realpath(
32 __file__)), 'significantly_different_inner.py')
33
34 conda_environ = dict(os.environ)
35 del conda_environ["PYTHONPATH"]
36
37 return json.loads(subprocess.check_output(
38 [anaconda_path, inner_script_location,list_a, list_b, significance],
39 env=conda_environ))
40
41 if __name__ == '__main__':
42 result = main(sys.argv)
43 if result:
44 print json.dumps(result, indent=4)
45 sys.exit(0)
46 sys.exit(1)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698