361{
362
363
364
365
369 if (alternative.isEmpty()) {
370 VP1Msg::message(
"ERROR: The DISPLAY environment variable is "+QString(unset?
"not set":
"empty")+
".");
371 VP1Msg::message(
"This might be because something else in Athena has disabled it.");
373 "the DISPLAY_ORIG environment variable to the contents of DISPLAY before launching your job.");
377 VP1Msg::message(
"For the current job, I will try with DISPLAY=\":0.0\", which is the correct value when running locally.");
378 alternative=":0.0";
379 } else {
380 VP1Msg::message(
"WARNING: The DISPLAY environment variable is "+QString(unset?
"not set":
"empty")+
". Setting to value found in DISPLAY_ORIG");
381 }
382 VP1Msg::message(
"WARNING: Setting DISPLAY variable to '"+alternative+
"'");
384 }
385
386
387
388 QCoreApplication::setOrganizationName("ATLAS");
389 #if defined BUILDVP1LIGHT
390 QCoreApplication::setApplicationName("VP1Light");
391 #else
392 QCoreApplication::setApplicationName("VP1");
393 #endif
394 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
395
396
397
398
399 if (qApp) {
400 VP1Msg::message(
"VP1ExecutionScheduler::init ERROR: QApplication already initialized. Expect problems!!!");
401 } else {
402
404 static char execpath[] = "/some/fake/executable/vp1";
405 static char *
argv[2];
406
408
410
411
412
413
414
415 new VP1QtApplication(argc, argv);
416 }
417
418 VP1AvailEvents * availEvents(0);
419 if (!singleEventSource.isEmpty()&&!singleEventLocalTmpDir.isEmpty()) {
420 const bool httpmode = singleEventSource.startsWith("http://");
421 const bool httpsmode = singleEventSource.startsWith("https://");
422
423 if (httpmode) {
424 availEvents = new VP1AvailEvtsHttp(singleEventSource, 60, 30*60, singleEventLocalTmpDir,localFileCacheLimit);
425 } else if(httpsmode) {
426 availEvents = new VP1AvailEvtsHttps(singleEventSource, 1000, 30*60, singleEventLocalTmpDir,localFileCacheLimit);
427 } else {
428 availEvents = new VP1AvailEvtsLocalDir(5*60, singleEventSource,
429 singleEventLocalTmpDir,localFileCacheLimit);
430 static_cast<VP1AvailEvtsLocalDir*>(availEvents)->setAvailableSourceDirectories(availableLocalInputDirectories);
431
432 }
433
434 }
435
437
438
439 if (joboptions.empty()) {
440
441 } else {
442 qDebug() << "config files: " << joboptions;
443 for (const QString& opt : joboptions)
445
448 if (joboptions.size() != 0 ) {
450 }
451 }
453 if (batchNevents > 0 ) {
455 }
456 }
457 }
458
459
460 if (scheduler->
m_d->
mainwindow->tabWidget_central->count()<=1) {
461 if (initialCruiseMode=="TAB") {
462 VP1Msg::message(
"ERROR: Can not start in cruisemode TAB unless there are at least 2 tabs loaded from initial .vp1 files. Reverting to cruise mode NONE.");
463 initialCruiseMode="NONE";
464 } else if (initialCruiseMode=="BOTH") {
465 VP1Msg::message(
"ERROR: Can not start in cruisemode BOTH unless there are at least 2 tabs loaded from initial .vp1 files. Reverting to cruise mode EVENT.");
466 initialCruiseMode="EVENT";
467 }
468 }
469
470
471 if (initialCruiseMode=="EVENT") {
473 scheduler->
m_d->
mainwindow->radioButton_cruise_event->setChecked(
true);
474 scheduler->
m_d->
mainwindow->pushButton_cruise->setChecked(
true);
475
476 } else if (initialCruiseMode=="TAB") {
478 scheduler->
m_d->
mainwindow->radioButton_cruise_tab->setChecked(
true);
479 scheduler->
m_d->
mainwindow->pushButton_cruise->setChecked(
true);
480 } else if (initialCruiseMode=="BOTH") {
482 scheduler->
m_d->
mainwindow->radioButton_cruise_both->setChecked(
true);
483 scheduler->
m_d->
mainwindow->pushButton_cruise->setChecked(
true);
484 } else {
485 if (initialCruiseMode!="NONE")
486 VP1Msg::message(
"ERROR: unknown initial cruise mode "+initialCruiseMode+
" (valid are NONE/EVENT/TAB/BOTH). Assuming NONE.");
488 scheduler->
m_d->
mainwindow->radioButton_cruise_event->setChecked(
true);
489 scheduler->
m_d->
mainwindow->pushButton_cruise->setChecked(
false);
490 }
491
493
494 int cruisesecs = ( initialCruiseSeconds == 0 ? 0 :
495 std::max(scheduler->
m_d->
mainwindow->spinBox_cruise->minimum(),
496 std::min(scheduler->
m_d->
mainwindow->spinBox_cruise->maximum(),
497 static_cast<int>(initialCruiseSeconds))));
498 if ( cruisesecs>0 )
499 scheduler->
m_d->
mainwindow->spinBox_cruise->setValue(cruisesecs);
500
501
502 return scheduler;
503}
std::vector< std::string > qstringlistToVecString(const QStringList &list)
bool batchModeRandomConfig
VP1BatchUtilities * batchUtilities
VP1ExecutionScheduler(QObject *parent, StoreGateSvc *eventStore, StoreGateSvc *detStore, ISvcLocator *svcLocator, IToolSvc *toolSvc, VP1AvailEvents *availEvents)
void request_cruisemodechange()
void loadConfigurationFromFile(const QString &file)
static QString environmentVariableValue(const QString &name)
static void setEnvironmentVariable(const QString &name, const QString &content)