Skip to content

Commit 82b553f

Browse files
authored
Ticket139 take two (#142)
* use -j to specify the top level parallelization granularity * attempt to fix the retrieval of reference files git hash
1 parent d29877d commit 82b553f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The scripts from this repository can be used to run regression tests for public,
111111
- `--fmisimulator=''`: The default is nothing but you can use the path to OMSimulator executable or 'fmpy'
112112
- `--ulimitvmem=8388608`: Virtual memory limit (in kB)
113113
- `--default=[]`: Add a default value for some configuration key, such as --default=ulimitExe=60. The equals sign is mandatory
114-
- `-j`,`--jobs`: Number of threads to use for testing. Deprecated, use procOMC and procCCompile inside the config json
114+
- `-j`,`--jobs`: Number of cores to use for testing, default is 0 (max cores), use 1 to run serial (for large tests) and see procOMC and procCCompile above for more insight into individual test parallelization
115115
116116
- Generate HTML results
117117
```bash

test.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ def target():
203203
print("Sanity check failed (./testmodel.py --help):\n" + e.output.decode())
204204
sys.exit(1)
205205

206-
# ignored j argument, use procOMC and procCCompile in config
207-
n_jobs = psutil.cpu_count(logical=False)
206+
# how many jobs in parallel?
207+
n_cores = psutil.cpu_count(logical=False)
208+
if n_jobs == 0:
209+
n_jobs = n_cores
208210

209211
print("branch: %s, n_jobs: %d" % (branch, n_jobs))
210212

@@ -578,7 +580,7 @@ def hashReferenceFiles(s):
578580
# if procCompile = 0 use max procs, use procCompile = 1 if not defined, else use the given value
579581
if "procCCompile" in conf:
580582
if conf.get("procCCompile") == 0:
581-
conf["procCCompile"] = n_jobs
583+
conf["procCCompile"] = n_cores
582584
else:
583585
conf["procCCompile"] = 1
584586
conf["omc_thread_cmd"] = omc_threads
@@ -1008,8 +1010,16 @@ def cpu_name():
10081010
# adrpo: attempt to get the revision of the reference files if possible
10091011
if conf.get("referenceFiles"):
10101012
try:
1011-
gitReferenceFiles = conf.get("referenceFiles")
1012-
sys.stdout.flush()
1013+
c = conf.get("referenceFiles")
1014+
gitReferenceFiles = c
1015+
if isinstance(c, (str, bytes)):
1016+
m = re.search("^[$][A-Z]+", c)
1017+
if m:
1018+
k = m.group(0)[1:]
1019+
if k not in os.environ:
1020+
raise Exception("Environment variable %s not defined, but used in JSON config for reference files" % k)
1021+
gitReferenceFiles = c.replace(m.group(0), os.environ[k])
1022+
sys.stdout.flush()
10131023
try:
10141024
gitReferenceFilesURL = check_output_log(["git", "config", "get", "remote.origin.url"], cwd=gitReferenceFiles).decode("utf-8")
10151025
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)