| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# JobHistory.cpp

Go to the documentation of this file.

    00001
    00002 //
    00003 // $Id: JobHistory.cpp,v 1.1 2006/11/09 10:24:05 mato Exp $
    00004 //
    00005 // GaudiHistory/JobHistory.cpp
    00006 //
    00007 // Contains history information for a job. Imports all environment vars
    00008 // and info from uname
    00009 //
    00010 //
    00011 // @author: Charles Leggett
    00012 //
    00014
    00015 #include "GaudiKernel/JobHistory.h"
    00016 #include "GaudiKernel/System.h"
    00017 #include "GaudiKernel/Property.h"
    00018
    00019 #include <cstdlib>
    00020 #include <iostream>
    00021
    00022 using std::string;
    00023 using std::ostream;
    00024 using std::endl;
    00025 using std::vector;
    00026
    00027 //**********************************************************************
    00028 // Member functions.
    00029 //**********************************************************************
    00030
    00031 // Constructor.
    00032
    00033 JobHistory::JobHistory()
    00034 : m_start_time(0) {
    00035
    00036   time(&m_start_time);
    00037
    00038   std::string rel;
    00039
    00040   if  ( (rel = System::getEnv("ATLAS_BASE_RELEASE")) != "UNKNOWN" ) {
    00041     m_release_version = rel;
    00042   } else if ( (rel = System::getEnv("GAUDIROOT")) != "UNKNOWN" ) {
    00043     m_release_version = rel;
    00044   } else {
    00045     m_release_version = "UNKNOWN";
    00046   }
    00047   m_dir = System::getEnv("PWD");
    00048   m_cmtconfig = System::getEnv("CMTCONFIG");
    00049
    00050   m_osname = System::osName();
    00051   m_hostname = System::hostName();
    00052   m_os_version = System::osVersion();
    00053   m_machine = System::machineType();
    00054
    00055   m_environ = System::getEnv();
    00056
    00057 }
    00058
    00059 JobHistory::JobHistory(const std::string& rel, const std::string& os,
    00060                        const std::string& host, const std::string& dir,
    00061                        const std::string& osver, const std::string& mach,
    00062                        const std::string& cmtconfig,
    00063                        const time_t& time):
    00064   m_release_version(rel), m_dir(dir), m_cmtconfig(cmtconfig), m_osname(os),
    00065   m_hostname(host),
    00066   m_os_version(osver), m_machine(mach), m_start_time(time) {
    00067
    00068 }
    00069
    00070
    00071 //**********************************************************************
    00072
    00073 // Destructor.
    00074
    00075 JobHistory::~JobHistory() {
    00076 }
    00077
    00078 const CLID&
    00079 JobHistory::classID() {
    00080
    00081   static CLID CLID_JobHistory = 247994533;
    00082   return CLID_JobHistory;
    00083
    00084 }
    00085
    00086 void
    00087 JobHistory::addProperty(const std::string& client, const Property* prop) {
    00088 //  if (m_props.find(prop) == m_props.end()) {
    00089     m_ppl.push_back( std::pair<std::string, const Property*>(client,prop) );
    00090 //  }
    00091 }
    00092
    00093
    00094 void
    00095 JobHistory::dump(std::ostream& ost, const bool isXML, int /*ind*/) const {
    00096
    00097   if (!isXML) {
    00098     ost << "Release: " << release_version() << endl;
    00099     ost << "OS:      " << os() << endl;
    00100     ost << "OS ver:  " << os_version() << endl;
    00101     ost << "Host:    " << hostname() << endl;
    00102     ost << "Machine: " << machine() << endl;
    00103     ost << "Run dir: " << dir() << endl;
    00104     ost << "CMTCONFIG: " << cmtconfig() << endl;
    00105     ost << "Job start time: " << start_time() << endl << endl;
    00106     ost << "Properties: [" << endl;;
    00107     for ( JobHistory::PropertyPairList::const_iterator
    00108             ipprop=propertyPairs().begin();
    00109           ipprop!=propertyPairs().end(); ++ipprop ) {
    00110       std::string client = ipprop->first;
    00111       const Property* prop = ipprop->second;
    00112       ost << client << ":  ";
    00113       prop->fillStream(ost);
    00114       ost << endl;
    00115     }
    00116     ost << "]" << endl;
    00117     vector<string> env = environment();
    00118     for (vector<string>::const_iterator itr=env.begin();  itr != env.end();
    00119          ++itr) {
    00120       ost << *itr << endl;
    00121     }
    00122   } else {
    00123
    00124   }
    00125
    00126 }
    00127
    00128
    00129
    00130 //**********************************************************************
    00131 // Free functions.
    00132 //**********************************************************************
    00133
    00134 // Output stream.
    00135
    00136 ostream& operator<<(ostream& lhs, const JobHistory& rhs) {
    00137
    00138   rhs.dump(lhs,false);
    00139
    00140   return lhs;
    00141 }
    00142
    00143 //**********************************************************************

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines