LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
PipelineLogEvent.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008, 2009, 2010 LSST Corporation.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 
24 // -*- lsst-c++ -*-
34 #include <iomanip>
35 #include <sstream>
36 #include <stdexcept>
37 #include <limits>
38 #include <cstring>
39 
41 #include "lsst/ctrl/events/Event.h"
46 #include "lsst/pex/exceptions.h"
47 
48 namespace pexExceptions = lsst::pex::exceptions;
49 namespace pexLogging = lsst::pex::logging;
50 
51 
52 using namespace std;
53 
54 namespace lsst {
55 namespace ctrl {
56 namespace events {
57 
58 const std::string PipelineLogEvent::DATAID = "DATAID";
59 const std::string PipelineLogEvent::LOOPNUM = "LOOPNUM";
60 const std::string PipelineLogEvent::PIPELINE = "PIPELINE";
61 const std::string PipelineLogEvent::SLICEID = "SLICEID";
62 const std::string PipelineLogEvent::STAGEID = "STAGEID";
63 
68 PipelineLogEvent::PipelineLogEvent() : LogEvent() {
69  _init();
70 }
71 
72 
79 }
80 
81 PipelineLogEvent::PipelineLogEvent(cms::TextMessage *msg) : LogEvent(msg) {
82 
83  _init();
84 
85  _psp->set(PipelineLogEvent::DATAID, msg->getStringProperty(PipelineLogEvent::DATAID));
86  _psp->set(PipelineLogEvent::LOOPNUM, msg->getIntProperty(PipelineLogEvent::LOOPNUM));
87  _psp->set(PipelineLogEvent::PIPELINE, msg->getStringProperty(PipelineLogEvent::PIPELINE));
88  _psp->set(PipelineLogEvent::SLICEID, msg->getIntProperty(PipelineLogEvent::SLICEID));
89  _psp->set(PipelineLogEvent::STAGEID, msg->getIntProperty(PipelineLogEvent::STAGEID));
90 
91 }
92 
93 PipelineLogEvent::PipelineLogEvent( const std::string& runId, const pexLogging::LogRecord& rec) : LogEvent(runId, rec) {
94  _init();
95 
96 
97  const PropertySet& ps = rec.getProperties();
98 
100 
102  _psp->set(PipelineLogEvent::DATAID, "unknown");
103  else
105 
108  else
110 
111 
113  _psp->set(PipelineLogEvent::PIPELINE, "unknown");
114  } else
116 
119  else
121 
124  else
126 
127 }
128 
129 void PipelineLogEvent::populateHeader(cms::TextMessage* msg) const {
131 
132  msg->setStringProperty(PipelineLogEvent::DATAID, _psp->get<std::string>(PipelineLogEvent::DATAID));
133  msg->setIntProperty(PipelineLogEvent::LOOPNUM, _psp->get<int>(PipelineLogEvent::LOOPNUM));
134  msg->setStringProperty(PipelineLogEvent::PIPELINE, _psp->get<std::string>(PipelineLogEvent::PIPELINE));
135  msg->setIntProperty(PipelineLogEvent::SLICEID, _psp->get<int>(PipelineLogEvent::SLICEID));
136  msg->setIntProperty(PipelineLogEvent::STAGEID, _psp->get<int>(PipelineLogEvent::STAGEID));
137 }
138 
140  return _psp->get<std::string>(PipelineLogEvent::DATAID);
141 }
142 
144  return _psp->get<int>(PipelineLogEvent::LOOPNUM);
145 }
146 
148  return _psp->get<std::string>(PipelineLogEvent::PIPELINE);
149 }
150 
152  return _psp->get<int>(PipelineLogEvent::SLICEID);
153 }
154 
156  return _psp->get<int>(PipelineLogEvent::STAGEID);
157 }
158 
162 }
163 
164 }
165 }
166 }
static const std::string STAGEID
PropertySet::Ptr _psp
Definition: Event.h:117
static const std::string PIPELINELOG
Definition: EventTypes.h:50
static const std::string LOOPNUM
Representation of an LSST Event.
Definition: LogEvent.h:67
defines EventTypes
static const std::string TYPE
Creates Event which contains a PropertySet.
Definition: Event.h:71
defines the PipelineLogEvent class
static const std::string SLICEID
virtual void populateHeader(cms::TextMessage *msg) const
Definition: LogEvent.cc:134
a container for constructing a single Log record
Definition: LogRecord.h:99
int getAsInt(std::string const &name) const
Definition: PropertySet.cc:333
Include files required for standard LSST Exception handling.
defines the Event class
defines the LogEvent class
Class for storing generic metadata.
Definition: PropertySet.h:82
std::string getAsString(std::string const &name) const
Definition: PropertySet.cc:444
Interface for PropertySet class.
const lsst::daf::base::PropertySet & getProperties() const
Definition: LogRecord.h:209
set< std::string > _keywords
Definition: Event.h:118
static const std::string DATAID
defines the EventSystem class
bool exists(std::string const &name) const
Definition: PropertySet.cc:190
static const std::string PIPELINE
PipelineLogEvent()
Creates PipelineLogEvent which contains a PropertySet.
virtual void populateHeader(cms::TextMessage *msg) const