Skip to content

Commit 1db1426

Browse files
Roland Lichtersjenkins
authored andcommitted
QPR-12433 clean up at the beginning of run
1 parent cd72379 commit 1db1426

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

OREAnalytics/orea/app/oreapp.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ void OREApp::initFromParams() {
354354
CONSOLE("OK");
355355

356356
Settings::instance().evaluationDate() = inputs_->asof();
357+
LOG("initFromParameters done, requested analytics:" << to_string(inputs_->analytics()));
357358
}
358359

359360
void OREApp::initFromInputs() {
@@ -366,6 +367,7 @@ void OREApp::initFromInputs() {
366367

367368
outputPath_ = inputs_->resultsPath().string();
368369
setupLog(outputPath_, logFile_, logMask_, logRootPath_);
370+
LOG("initFromInputs done, requested analytics:" << to_string(inputs_->analytics()));
369371
}
370372

371373
OREApp::~OREApp() {
@@ -375,24 +377,27 @@ OREApp::~OREApp() {
375377

376378
void OREApp::run() {
377379

378-
// only one thread at a time should call run
380+
// Only one thread at a time should call run
379381
static std::mutex _s_mutex;
380382
std::lock_guard<std::mutex> lock(_s_mutex);
381383

382-
// clean up after finishing the run
383-
CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
384-
CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
385-
CleanUpLogSingleton cleanupLogSingleton(true, true);
384+
// Clean start, but leave Singletons intact after run is completed
385+
{
386+
CleanUpThreadLocalSingletons cleanupThreadLocalSingletons;
387+
CleanUpThreadGlobalSingletons cleanupThreadGloablSingletons;
388+
CleanUpLogSingleton cleanupLogSingleton(true, true);
389+
}
386390

387-
if (inputs_ == nullptr)
388-
initFromParams();
389-
else if (params_ == nullptr)
391+
// Use inputs when available, otherwise try params
392+
if (inputs_ != nullptr)
390393
initFromInputs();
394+
else if (params_ != nullptr)
395+
initFromParams();
391396
else {
392397
ALOG("both inputs are empty");
393-
return;
398+
return;
394399
}
395-
400+
396401
runTimer_.start();
397402

398403
try {

0 commit comments

Comments
 (0)