Anonymous avatar Anonymous committed 5cad0d4

Add possibility of initializing default barcode from an environment variable. Needed to work around an initialization order issue with ARA.

Comments (0)

Files changed (2)

+2011-06-25  scott snyder  <snyder@bnl.gov>
+
+	* Tagging Navigation-00-08-15.
+	* src/AthenaBarCodeImpl.cxx: Look for an environment variable to
+	set the default barcode.  Needed to work around an initialization
+	order issue with ARA.
+
 2011-06-14  scott snyder  <snyder@bnl.gov>
 
 	* Tagging Navigation-00-08-14.

src/AthenaBarCodeImpl.cxx

   //Set JobID Hash
   //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   if (!m_defaultHash) {
-    //    std::cout<<"no UUID stored, generating."<<std::endl;
+    // First look for a uuid as an environment variable.
+    // This can be set in cases where we don't have the full
+    // Gaudi/Athena environment available (eg, ARA), and we
+    // don't want to try to create JobIDSvc.  This has to be
+    // communicated in some way external to this library,
+    // as we may end up here while initializing the dictionary
+    // for this library.
+    const char* env_uuid = getenv ("_ATHENABARCODEIMPL_JOBUUID");
+    if (env_uuid)
+      setDefaultHash (env_uuid);
+    else {
+      //    std::cout<<"no UUID stored, generating."<<std::endl;
 
-    ServiceHandle<IJobIDSvc> p_jobidsvc("JobIDSvc", "JobIDSvc");
-    StatusCode sc = p_jobidsvc.retrieve();
-    if (!sc.isSuccess() || 0 == p_jobidsvc) {
-      //FIXME
-      //use uuid instead if service not available
-      JobID_t m_JobID;
-      uuid_generate(m_JobID);
-      m_defaultHash = AthenaBarCodeImpl::hashUUID((const char *) m_JobID);
-      /*      std::cout << "Could not find JobIDSvc, using uuid directly"
+      ServiceHandle<IJobIDSvc> p_jobidsvc("JobIDSvc", "JobIDSvc");
+      StatusCode sc = p_jobidsvc.retrieve();
+      if (!sc.isSuccess() || 0 == p_jobidsvc) {
+        //FIXME
+        //use uuid instead if service not available
+        JobID_t m_JobID;
+        uuid_generate(m_JobID);
+        m_defaultHash = AthenaBarCodeImpl::hashUUID((const char *) m_JobID);
+        /*      std::cout << "Could not find JobIDSvc, using uuid directly"
 		<<"jobid "<<o.str()
 		<< std::endl;*/
-    }
-    else {
-      PJobID_t pjobid = p_jobidsvc->getJobID();
-      m_defaultHash = AthenaBarCodeImpl::hashUUID((const char *) pjobid);
+      }
+      else {
+        PJobID_t pjobid = p_jobidsvc->getJobID();
+        m_defaultHash = AthenaBarCodeImpl::hashUUID((const char *) pjobid);
+      }
     }
   }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.