Skip to content

Commit 67cce53

Browse files
committed
null yaml bugfix
1 parent 0fe93f8 commit 67cce53

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

common-tools/clas-reco/src/main/java/org/jlab/clas/reco/ReconMutil.java

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,40 @@ final class ReconMutil {
9898
* @param input names of input files to read
9999
*/
100100
void launch(int[] threads, String output, String... input) {
101+
101102
reset();
103+
104+
// spawn all the threads:
102105
readerThread = CompletableFuture.runAsync(() -> { read(threads[0], input); });
103106
writerThread = CompletableFuture.runAsync(() -> { write(output); });
104107
for (int i=0; i<threads[0]; i++) {
105108
final int j = i;
106109
decoThreads.offer(CompletableFuture.runAsync(() -> { decode(j); }));
107110
procThreads.offer(CompletableFuture.runAsync(() -> { process(j); }));
108111
}
112+
113+
// wait for the writer to be done:
109114
while (!writerThread.isDone()) {
110115
sleep(100);
116+
117+
// cleanup completed parallel threads:
111118
for (CompletableFuture f : decoThreads)
112119
if (f.isDone()) decoThreads.remove(f);
113120
for (CompletableFuture f : procThreads)
114121
if (f.isDone()) procThreads.remove(f);
122+
123+
// perform scaling test:
115124
if (threads.length > 1 && rethreadThread == null && writeEvents > 100) {
116125
rethreadThread = CompletableFuture.runAsync(() -> { rethread(BENCH_SECONDS,threads); });
117126
rethreadThread.join();
118127
reset();
119128
}
120129
}
121-
if (!parser.getOption("-P").isDefault()) {
122-
PostProcessor pp = new PostProcessor(parser.getInputList(), false, false);
123-
pp.processFile(output, output);
124-
}
130+
131+
//if (!parser.getOption("-P").isDefault()) {
132+
// PostProcessor pp = new PostProcessor(parser.getInputList(), false, false);
133+
// pp.processFile(output, output);
134+
//}
125135
}
126136

127137
/**
@@ -339,23 +349,25 @@ HipoWriterSorted open(String filename, ClaraYaml yaml) {
339349
HipoWriterSorted w = new HipoWriterSorted();
340350
w.setCompressionType(2);
341351
String d = ClasUtilsFile.getResourceDir("CLAS12DIR", "etc/bankdefs/hipo4");
342-
if (yaml.getSchemaDirectory() != null) d = yaml.getSchemaDirectory();
352+
if (yaml != null && yaml.getSchemaDirectory() != null) d = yaml.getSchemaDirectory();
343353
if (!parser.getOption("-S").isDefault()) d = parser.getOption("-S").stringValue();
344354
SchemaFactory s = new SchemaFactory();
345355
s.initFromDirectory(d);
346-
JSONObject json = yaml.filter("writer");
347-
if (json.has("wildcard")) {
348-
SchemaFactory s2 = s.reduce(json.getString("wildcard"));
349-
w.getSchemaFactory().copy(s2);
350-
}
351-
else w.getSchemaFactory().copy(s);
352-
schemaBankList = new ArrayList<>();
353-
if (json.has("wildcard")) {
354-
if (json.optBoolean("schema_filter",true)) {
355-
int schemaSize = w.getSchemaFactory().getSchemaList().size();
356-
for (int i=0; i<schemaSize; i++) {
357-
Bank dataBank = new Bank(w.getSchemaFactory().getSchemaList().get(i));
358-
schemaBankList.add(dataBank);
356+
if (yaml != null) {
357+
JSONObject json = yaml.filter("writer");
358+
if (json.has("wildcard")) {
359+
SchemaFactory s2 = s.reduce(json.getString("wildcard"));
360+
w.getSchemaFactory().copy(s2);
361+
}
362+
else w.getSchemaFactory().copy(s);
363+
schemaBankList = new ArrayList<>();
364+
if (json.has("wildcard")) {
365+
if (json.optBoolean("schema_filter",true)) {
366+
int schemaSize = w.getSchemaFactory().getSchemaList().size();
367+
for (int i=0; i<schemaSize; i++) {
368+
Bank dataBank = new Bank(w.getSchemaFactory().getSchemaList().get(i));
369+
schemaBankList.add(dataBank);
370+
}
359371
}
360372
}
361373
}
@@ -406,7 +418,7 @@ void close() {
406418
}
407419

408420
/**
409-
* Forcefully shutdown all threads, close files, and reset queuess and counters.
421+
* Forcefully shutdown all threads, close files, and reset queues and counters.
410422
*/
411423
void reset() {
412424
for (CompletableFuture f : procThreads) f.cancel(true);

validation/advanced-tests/run-eb-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if [ $? != 0 ] ; then echo "EBTwoTrackTest compilation failure" ; exit 1 ; fi
4949

5050
# run reconstruction:
5151
rm -f out_${stub}.hipo
52-
echo ../../coatjava/bin/recon-mutil -t 6 -l FINE -o out_${stub}.hipo ${input_dir}/${stub}.hipo
52+
../../coatjava/bin/recon-mutil -t 6 -l INFO -o out_${stub}.hipo ${input_dir}/${stub}.hipo
5353
exit
5454

5555
# run EB tests:

0 commit comments

Comments
 (0)