Skip to content

Commit d543c04

Browse files
authored
Out of Place GEOS ATS (#6)
* Removing unused code, fixing reports * Using dataclass in geos_ats.reporting * Updating the reporting dataclass for geos_ats * Adding an error for tests without restart or curve checks * Fixing curve check paths * Adding duplicate test check
1 parent 653b6cf commit d543c04

File tree

12 files changed

+374
-1805
lines changed

12 files changed

+374
-1805
lines changed

geos_ats_package/geos_ats/command_line_parsers.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def build_command_line_parser():
4040

4141
parser.add_argument( "geos_bin_dir", type=str, help="GEOS binary directory." )
4242

43-
parser.add_argument( "-w", "--workingDir", type=str, help="Initial working directory" )
43+
parser.add_argument( "ats_target", type=str, help="ats file" )
44+
45+
parser.add_argument( "-w", "--workingDir", type=str, help="Root working directory" )
46+
47+
parser.add_argument( "-b", "--baselineDir", type=str, help="Root baseline directory" )
4448

4549
action_names = ','.join( action_options.keys() )
4650
parser.add_argument( "-a", "--action", type=str, default="run", help=f"Test actions options ({action_names})" )
@@ -89,6 +93,8 @@ def build_command_line_parser():
8993

9094
parser.add_argument( "-l", "--logs", type=str, default=None )
9195

96+
parser.add_argument( "-f", "--allow-failed-tests", default=False, action='store_true' )
97+
9298
parser.add_argument(
9399
"--failIfTestsFail",
94100
action="store_true",
@@ -98,8 +104,6 @@ def build_command_line_parser():
98104

99105
parser.add_argument( "-n", "-N", "--numNodes", type=int, default="2" )
100106

101-
parser.add_argument( "ats_targets", type=str, nargs='*', help="ats files or directories." )
102-
103107
return parser
104108

105109

@@ -127,6 +131,13 @@ def parse_command_line_arguments( args ):
127131
print( f"Selected verbose option ({verbose}) not recognized" )
128132
exit_flag = True
129133

134+
# Paths
135+
if not options.workingDir:
136+
options.workingDir = os.path.basename( options.ats_target )
137+
138+
if not options.baselineDir:
139+
options.baselineDir = options.workingDir
140+
130141
# Print detailed information
131142
if options.detail:
132143
for option_type, details in zip( [ 'action', 'check' ], [ action_options, check_options ] ):
@@ -139,22 +150,3 @@ def parse_command_line_arguments( args ):
139150
quit()
140151

141152
return options
142-
143-
144-
def patch_parser( parser ):
145-
146-
def add_option_patch( *xargs, **kwargs ):
147-
"""
148-
Convert type string to actual type instance
149-
"""
150-
tmp = kwargs.get( 'type', str )
151-
type_map = { 'string': str }
152-
if isinstance( tmp, str ):
153-
if tmp in type_map:
154-
tmp = type_map[ tmp ]
155-
else:
156-
tmp = locate( tmp )
157-
kwargs[ 'type' ] = tmp
158-
parser.add_argument( *xargs, **kwargs )
159-
160-
parser.add_option = add_option_patch

geos_ats_package/geos_ats/configuration_record.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def initializeConfig( configFile, configOverride, options ):
167167
geos_atsdir = os.path.realpath( os.path.dirname( __file__ ) )
168168

169169
# configfile
170-
config.add( "testbaseline_dir", str, "", "Base directory that contains all the baselines" )
170+
config.add( "testbaseline_directory", str, "", "Base directory that contains all the baselines" )
171171

172172
config.add( "geos_bin_dir", str, "", "Directory that contains 'geos' and related executables." )
173173

@@ -194,11 +194,6 @@ def initializeConfig( configFile, configOverride, options ):
194194
config.add( "report_doc_remake", bool, False,
195195
"Remake test documentation, even if it already exists (used with html reports)" )
196196

197-
config.add( "report_text", bool, True, "True if you want text results to be generated with the report action" )
198-
config.add( "report_text_file", str, "test_results.txt", "Location to write the text report" )
199-
config.add( "report_text_echo", bool, True, "If True, echo the report to stdout" )
200-
config.add( "report_wait", bool, False, "Wait until all tests are complete before reporting" )
201-
202197
config.add( "report_ini", bool, True, "True if you want ini results to be generated with the report action" )
203198
config.add( "report_ini_file", str, "test_results.ini", "Location to write the ini report" )
204199

@@ -213,10 +208,6 @@ def initializeConfig( configFile, configOverride, options ):
213208
config.add( "checkmessages_never_ignore_regexp", type( [] ), [ "not yet implemented" ],
214209
"Regular expression to not ignore in all checkmessages steps." )
215210

216-
config.add( "report_timing", bool, False, "True if you want timing file to be generated with the report action" )
217-
config.add( "report_timing_overwrite", bool, False,
218-
"True if you want timing file to overwrite existing timing file rather than augment it" )
219-
220211
# timing and priority
221212
config.add( "priority", str, "equal", "Method of prioritization of tests: [\"equal\", \"processors\",\"timing\"]" )
222213
config.add( "timing_file", str, "timing.txt", "Location of timing file" )

geos_ats_package/geos_ats/environment_setup.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
import argparse
55

66

7-
def setup_ats( src_path, build_path, ats_xargs, ats_machine, ats_machine_dir ):
7+
def setup_ats( src_path, build_path, baseline_dir, working_dir, ats_xargs, ats_machine, ats_machine_dir ):
88
bin_dir = os.path.join( build_path, "bin" )
99
geos_ats_fname = os.path.join( bin_dir, "run_geos_ats" )
10-
ats_dir = os.path.abspath( os.path.join( src_path, "integratedTests", "tests", "allTests" ) )
1110
test_path = os.path.join( build_path, "integratedTests" )
1211
link_path = os.path.join( test_path, "integratedTests" )
1312
run_script_fname = os.path.join( test_path, "geos_ats.sh" )
1413
log_dir = os.path.join( test_path, "TestResults" )
14+
baseline_dir = os.path.abspath( baseline_dir )
15+
working_dir = os.path.abspath( working_dir )
16+
ats_main_file = os.path.abspath( os.path.join( src_path, 'inputFiles', 'main.ats' ) )
1517

16-
# Create a symbolic link to test directory
18+
# Create a symbolic link to working directory
19+
for d in [ baseline_dir, working_dir, test_path ]:
20+
os.makedirs( d, exist_ok=True )
1721
if os.path.islink( link_path ):
1822
print( 'integratedTests symlink already exists' )
1923
else:
20-
os.symlink( ats_dir, link_path )
24+
os.symlink( working_dir, link_path )
2125

2226
# Build extra arguments that should be passed to ATS
2327
joined_args = [ ' '.join( x ) for x in ats_xargs ]
@@ -30,7 +34,9 @@ def setup_ats( src_path, build_path, ats_xargs, ats_machine, ats_machine_dir ):
3034
# Write the bash script to run ats.
3135
with open( run_script_fname, "w" ) as g:
3236
g.write( "#!/bin/bash\n" )
33-
g.write( f"{geos_ats_fname} {bin_dir} --workingDir {ats_dir} --logs {log_dir} {ats_args} \"$@\"\n" )
37+
g.write(
38+
f"{geos_ats_fname} {bin_dir} {ats_main_file} --workingDir {working_dir} --baselineDir {baseline_dir} --logs {log_dir} {ats_args} \"$@\"\n"
39+
)
3440

3541
# Make the script executable
3642
st = os.stat( run_script_fname )
@@ -46,6 +52,8 @@ def main():
4652
parser = argparse.ArgumentParser( description="Setup ATS script" )
4753
parser.add_argument( "src_path", type=str, help="GEOS src path" )
4854
parser.add_argument( "build_path", type=str, help="GEOS build path" )
55+
parser.add_argument( "baseline_dir", type=str, help="GEOS test baseline root directory" )
56+
parser.add_argument( "working_dir", type=str, help="GEOS test working root directory" )
4957
parser.add_argument( "--ats",
5058
nargs='+',
5159
default=[],
@@ -54,7 +62,8 @@ def main():
5462
parser.add_argument( "--machine", type=str, default='', help="ATS machine name" )
5563
parser.add_argument( "--machine-dir", type=str, default='', help="ATS machine directory" )
5664
options, unkown_args = parser.parse_known_args()
57-
setup_ats( options.src_path, options.build_path, options.ats, options.machine, options.machine_dir )
65+
setup_ats( options.src_path, options.build_path, options.baseline_dir, options.working_dir, options.ats,
66+
options.machine, options.machine_dir )
5867

5968

6069
if __name__ == '__main__':

geos_ats_package/geos_ats/helpers/curve_check.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,20 +275,17 @@ def compare_time_history_curves( fname, baseline, curve, tolerance, output, outp
275275
# Generate script-based curve
276276
if script_instructions and ( len( data ) > 0 ):
277277
data[ 'script' ] = {}
278-
try:
279-
for script, fn, p, s in script_instructions:
280-
k = location_strings[ p ]
281-
data[ 'script' ][ f'{p} Time' ] = data[ 'target' ][ f'{p} Time' ]
282-
key = f'{p} {k}'
283-
key2 = f'{p}'
284-
if s != DEFAULT_SET_NAME:
285-
key += f' {s}'
286-
key2 += f' {s}'
287-
data[ 'script' ][ key ] = data[ 'target' ][ key ]
288-
data[ 'script' ][ key2 ] = evaluate_external_script( script, fn, data[ 'target' ] )
289-
data_sizes[ p ][ s ][ 'script' ] = list( np.shape( data[ 'script' ][ key2 ] ) )
290-
except Exception as e:
291-
errors.append( str( e ) )
278+
for script, fn, p, s in script_instructions:
279+
k = location_strings[ p ]
280+
data[ 'script' ][ f'{p} Time' ] = data[ 'target' ][ f'{p} Time' ]
281+
key = f'{p} {k}'
282+
key2 = f'{p}'
283+
if s != DEFAULT_SET_NAME:
284+
key += f' {s}'
285+
key2 += f' {s}'
286+
data[ 'script' ][ key ] = data[ 'target' ][ key ]
287+
data[ 'script' ][ key2 ] = evaluate_external_script( script, fn, data[ 'target' ] )
288+
data_sizes[ p ][ s ][ 'script' ] = list( np.shape( data[ 'script' ][ key2 ] ) )
292289

293290
# Reshape data if necessary so that they have a predictable number of dimensions
294291
for k in data.keys():

geos_ats_package/geos_ats/machines/batchGeosatsMoab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#BATS:batchGeosatsMoab batchGeosatsMoab BatchGeosatsMoab -1
22

33
from ats import machines, configuration, log, atsut, times, AtsTest # type: ignore[import]
4-
import subprocess, sys, os, shlex, time, socket, re
5-
import utils, batchTemplate # type: ignore[import]
4+
import subprocess, sys, os, time, socket, re
5+
import utils # type: ignore[import]
66
from batch import BatchMachine # type: ignore[import]
77
import logging
88

0 commit comments

Comments
 (0)