]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
repairing server's action after EOR signal
authorjniedzie <jeremi.niedziela@cern.ch>
Tue, 30 Sep 2014 05:57:42 +0000 (07:57 +0200)
committerjniedzie <jeremi.niedziela@cern.ch>
Mon, 13 Oct 2014 06:18:03 +0000 (08:18 +0200)
MONITOR/alieventserver/AliEventServer.cxx
MONITOR/alieventserver/AliEventServerReconstruction.cxx
MONITOR/alieventserver/AliEventServerReconstruction.h
MONITOR/alieventserver/AliEventServerWindow.cxx
MONITOR/alieventserver/alieventserver.rootrc

index 7c9261fb253dc392e2a5418674bafcb1d60338a5..723079a0d18037466dd3e94adf10de032c3151da 100644 (file)
@@ -81,8 +81,14 @@ void AliEventServer::StartOfRun(Int_t run)
 {
   cout<<"SOR signal received for run:"<<run<<endl;
   if(run<=0) return;
+  /*
+  while(!fRecoServer->StopReconstruction())
+    {
+      cout<<"Waiting for previous reco to be fully initialized"<<endl;
+      sleep(10);
+      }*/
   fRecoServer->StopReconstruction();
-       
+
   TEnv settings;
   settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
     
index ed93a2e0751b2566c9daaf98de90e12fe0a7986b..5744b875135859fbff74f92741c0eedac1b33732 100644 (file)
@@ -45,7 +45,8 @@ AliEventServerReconstruction::AliEventServerReconstruction()
          fSettings(0),
          fHost(0),
          fRecoThread(0),
-         fRecoIsRunning(false)
+         fRecoIsRunning(false),
+         fRecoWasInitialized(false)
 {}
 
 AliEventServerReconstruction::~AliEventServerReconstruction()
@@ -67,6 +68,7 @@ void AliEventServerReconstruction::Close()
 
 Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char* input)
 {
+  cout<<"Start of run:"<<run<<endl;
        fCurrentRunId = run;
 
        // re-read settings
@@ -85,6 +87,7 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        }
        gSystem->cd(recoBaseDir.Data());
 
+
        TString gdcs;
        if (RetrieveGRP(run,gdcs) <= 0 || gdcs.IsNull()){return kFALSE;}
          
@@ -92,32 +95,33 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        gSystem->cd(Form("run%d", run));
 
        // Create Reco and Reco Thread
+       cout<<"Setup reco will be called"<<endl;
        SetupReco(input);
        
        fHost = (const char*)Form("%s:%d", fSettings->GetValue("server.host", DEFAULT_SERVER_HOST), fSettings->GetValue("server.port", DEFAULT_SERVER_PORT));
        
-       fRecoThread = new TThread("AliEventServerReconstruction",
-                              Dispatch,
-                              (void*)this);
+       cout<<"Creating new thread"<<endl;
+       fRecoThread = new TThread("AliEventServerReconstruction",Dispatch, (void*)this);
        fRecoThread->Run();
        fIsListenning = kTRUE;
        fRecoIsRunning=true;
-
+       cout<<"Reco started"<<endl;
        return true;
 }
 
-void AliEventServerReconstruction::StopReconstruction()
+bool AliEventServerReconstruction::StopReconstruction()
 {
   cout<<"Reco server -- StopPeconstruction() called"<<endl;
-  if(!fRecoIsRunning)
+  if(!fRecoIsRunning || !fRecoThread)
     {
-      cout<<"Reco is not running. Returning"<<endl;
-      return;
+      cout<<"Reco is not running. No need to stop it."<<endl;
+      return true;
     }
-  if(!fRecoThread) 
+  if(!fRecoWasInitialized)
     {
-      cout<<"Reco server -- no thread. Returning"<<endl;
-      return;
+      cout<<"Reco is under initialization. Wait until it's finished"<<endl;
+      
+      return false;
     }
   cout<<"killing thread"<<endl;
   fRecoThread->Kill();
@@ -129,15 +133,17 @@ void AliEventServerReconstruction::StopReconstruction()
 
   cout<<"Reco server -- terminating reconstruction"<<endl;     
   fAliReco->SlaveTerminate();
-  if (fAliReco->GetAbort() != TSelector::kContinue) return;
+  if (fAliReco->GetAbort() != TSelector::kContinue) return false;
   fAliReco->Terminate();
-  if (fAliReco->GetAbort() != TSelector::kContinue) return; 
+  if (fAliReco->GetAbort() != TSelector::kContinue) return false
        
   if(fAliReco){delete fAliReco;fAliReco=0;}
   cout<<"Reco server -- deleting CDBManager"<<endl;
-  if(fCDBmanager){delete fCDBmanager;fCDBmanager=0;}
+  if(fCDBmanager){fCDBmanager->Destroy();fCDBmanager=0;}
   cout<<"Reco server -- recontruction stopped"<<endl;
   fRecoIsRunning=false;
+  fRecoWasInitialized=false;
+  return true;
 }
 
 void AliEventServerReconstruction::ReconstructionHandle()
@@ -146,20 +152,22 @@ void AliEventServerReconstruction::ReconstructionHandle()
        TThread::SetCancelOn();
        
        if(!fAliReco) return;
-       
-       AliESDEvent* event;
-       
+
        AliStorageEventManager *eventManager = AliStorageEventManager::GetEventManagerInstance();
        eventManager->CreateSocket(EVENTS_SERVER_PUB);
        eventManager->CreateSocket(XML_PUB);
-
+       cout<<"Sockets created"<<endl;
        fAliReco->Begin(NULL);
+       cout<<"Reco began"<<endl;
        if (fAliReco->GetAbort() != TSelector::kContinue) return;
        fAliReco->SlaveBegin(NULL);
+       cout<<"Slave began"<<endl;
        if (fAliReco->GetAbort() != TSelector::kContinue) return;
 
+       fRecoWasInitialized=true;
        //******* The loop over events
        Int_t iEvent = 0;
+       AliESDEvent* event;
        while (fAliReco->HasNextEventAfter(iEvent))
        {
                // check if process has enough resources 
@@ -180,12 +188,7 @@ void AliEventServerReconstruction::ReconstructionHandle()
                fAliReco->CleanProcessedEvent();
                iEvent++;
        }
-       fAliReco->SlaveTerminate();
-       if (fAliReco->GetAbort() != TSelector::kContinue) return;
-       fAliReco->Terminate();
-       if (fAliReco->GetAbort() != TSelector::kContinue) return;
        StopReconstruction();
-       fRecoIsRunning=false;
 }
 
 Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
index 1c78aa13bff4df9370420f53fc1ed328b3b0aa18..e8bc44f35cdf40afb26cab720543097706375e2a 100644 (file)
@@ -26,7 +26,7 @@ public:
        virtual ~AliEventServerReconstruction();
 
        Bool_t StartReconstruction(Int_t run, const char* input="mem://@*:");
-       void  StopReconstruction();  
+       bool  StopReconstruction();  
        
        // Closes the server. The server will no longer listen/serve
        void Close();
@@ -49,6 +49,8 @@ private:
        TString fHost;
        TThread *fRecoThread;
        bool fRecoIsRunning;
+       bool fRecoWasInitialized;
+       const char *fInput;
 
        AliEventServerReconstruction(const AliEventServerReconstruction&);
        AliEventServerReconstruction& operator=(const AliEventServerReconstruction&);
index f2938a65f8fd974f6fbc63d4d21791b40490e61d..764069d322b876bd36208a6d9617d7ff9b9c81be 100644 (file)
@@ -275,7 +275,6 @@ void AliEventServerWindow::StartOfRun(Int_t run)
 
        // Slot called from DIM handler on start of run.
        AliInfo(Form("called for Run %d ", run));
-
        fRunList->AddEntrySort(TString::Format("%d", run), run);
        fRunList->Layout();
        gClient->NeedRedraw(fRunList);
index 753e5f7fc3b4e3e6f9a6a522526e3f3623e12032..84057b117b18d81133f717376b31cb91a3aa6fdb 100644 (file)
@@ -15,7 +15,7 @@ reco.runPlaneEff:                        1
 reco.writeESDfriend:                     0
 reco.writeAlignment:                     1
 reco.cleanESD:                           0
-reco.detectors:                          ALL  -PHOS -EMCAL
+reco.detectors:                          ALL  -PHOS -EMCAL -HLT
 logbook.host:                            localhost
 logbook.port:                            3306
 logbook.db:                              logbook