-
Notifications
You must be signed in to change notification settings - Fork 1
/
queuetest.py
executable file
·115 lines (97 loc) · 4.29 KB
/
queuetest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import json
import sys
import os
import time
import mmap
from checkgms_utils import *
from checkgms_stable import *
run_arguments = parse_arguments(checkgms=False)
ppn = 6
print(c_box("Run parameters"))
print(json.dumps(run_arguments, indent=2))
script_path = os.path.dirname(os.path.realpath(__file__))
# Populate the log_file_paths array
input_file_paths = []
input_file_paths = get_input_file_paths(
folder_string_match=run_arguments["filter_folder"],
file_string_match=run_arguments["filter_file"],
folder_string_skip=run_arguments["skip_folder"],
file_string_skip=run_arguments["skip_file"],
script_path=script_path)
# Loop through the log_file_paths array and validate
for filenum, input_file_path in enumerate(input_file_paths, start=1):
short_input_file_path = input_file_path.split("/tests/", 1)[-1]
# Search for prescence of "TRAVIS-CI SKIP"
with open(input_file_path, 'r', encoding="utf-8", errors='ignore') as opened_file:
parse_memory_map = mmap.mmap(
opened_file.fileno(), 0, access=mmap.ACCESS_READ)
if not run_arguments["no_skip"]:
regex_string = "TRAVIS-CI SKIP"
regex = re.compile(str.encode(regex_string, 'ascii'), re.MULTILINE)
match = regex.search(parse_memory_map)
# If found then skip
if match:
if run_arguments["debug"]:
print(
l_box_small("Skipping input file"),
file_progress(
filenum,
len(input_file_paths)),
short_input_file_path)
continue
# If --test_type is passed in:
if "small" in run_arguments["test_type"]:
regex_string = "TRAVIS-CI SMALL"
elif "medium" in run_arguments["test_type"]:
regex_string = "TRAVIS-CI MEDIUM"
elif "large" in run_arguments["test_type"]:
regex_string = "TRAVIS-CI LARGE"
elif "msucc" in run_arguments["test_type"]:
regex_string = "TRAVIS-CI MSUCC"
if len(run_arguments["test_type"]) > 0:
regex = re.compile(str.encode(regex_string, 'ascii'), re.MULTILINE)
match = regex.search(parse_memory_map)
if not match:
if run_arguments["debug"]:
print(
l_box_small("Skipping input file"),
file_progress(
filenum,
len(input_file_paths)),
short_input_file_path)
continue
try:
ddi_comm = ""
if (run_arguments["mpi"]):
ddi_comm = "-mpi"
elif (run_arguments["hpe-cray-ex"]):
ddi_comm = "-hpe-cray-ex"
elif (run_arguments["hpe-cray-cs"]):
ddi_comm = "-hpe-cray-cs"
elif (run_arguments["cray-xt"]):
ddi_comm = "-cray-xt"
elif (run_arguments["cray-xc"]):
ddi_comm = "-cray-xc"
else:
ddi_comm = "-sockets"
if (int(run_arguments["ncpus"]) <= ppn):
job_submission_command = "gms" + " " + input_file_path + " -l " + input_file_path.replace(
".inp", run_arguments["output_extension"]) + " -p " + run_arguments["ncpus"] + " -ppn " + run_arguments["ncpus"] + " -w 2:0:0" + " -q " + run_arguments["queue"] + " -exclusive" + " -y " + ddi_comm + " -v " + run_arguments["version"]
else:
job_submission_command = "gms" + " " + input_file_path + " -l " + input_file_path.replace(
".inp", run_arguments["output_extension"]) + " -p " + run_arguments["ncpus"] + " -ppn " + str(ppn) + " -w 2:0:0" + " -q " + run_arguments["queue"] + " -exclusive" + " -y " + ddi_comm + " -v " + run_arguments["version"]
print(l_box_small("Submitting job for input file"), file_progress(
filenum, len(input_file_paths)), short_input_file_path)
if run_arguments["debug"] or run_arguments["dryrun"]:
print(job_submission_command)
if not run_arguments["dryrun"]:
os.system(job_submission_command)
time.sleep(2.5)
except KeyboardInterrupt:
time.sleep(2)
sys.exit(1)
except BaseException:
sys.exit(1)