]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
18 | Revision 1.3 2006/08/29 09:16:05 jgrosseo | |
19 | small update | |
20 | ||
21 | Revision 1.2 2006/08/15 10:50:00 jgrosseo | |
22 | effc++ corrections (alberto) | |
23 | ||
24 | Revision 1.1 2006/07/20 13:20:13 jgrosseo | |
25 | introducing status management: The processing per subdetector is divided into several steps, | |
26 | after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle | |
27 | can keep track of the number of failures and skips further processing after a certain threshold is | |
28 | exceeded. These thresholds can be configured in LDAP. | |
29 | ||
30 | */ | |
31 | ||
32 | // | |
33 | // This class stores the status of the Shuttle processing for a given run and a given detector | |
34 | // | |
35 | // This class stores the status of the processing, the number of retries and the timestamp of the last action | |
36 | // The detector and run number are stored using the CDB framework | |
37 | // | |
38 | // | |
39 | ||
40 | #include "AliShuttleStatus.h" | |
41 | ||
42 | ClassImp(AliShuttleStatus) | |
43 | ||
44 | //______________________________________________________________________________________________ | |
45 | AliShuttleStatus::AliShuttleStatus() : TObject(), | |
46 | fTimeStamp(0), | |
47 | fStatus(kInvalid), | |
48 | fCount(0) | |
49 | { | |
50 | // default constructor | |
51 | } | |
52 | ||
53 | //______________________________________________________________________________________________ | |
54 | AliShuttleStatus::AliShuttleStatus(Status status) : TObject(), | |
55 | fTimeStamp(0), | |
56 | fStatus(status), | |
57 | fCount(1) | |
58 | { | |
59 | // constructor | |
60 | ||
61 | fTimeStamp = time(0); | |
62 | } | |
63 | ||
64 | //______________________________________________________________________________________________ | |
65 | AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : | |
66 | TObject(c), fTimeStamp(0), | |
67 | fStatus(kInvalid), | |
68 | fCount(1) | |
69 | { | |
70 | // copy constructor | |
71 | ||
72 | ((AliShuttleStatus &)c).Copy(*this); | |
73 | } | |
74 | ||
75 | //______________________________________________________________________________________________ | |
76 | AliShuttleStatus::~AliShuttleStatus() | |
77 | { | |
78 | // destructor | |
79 | } | |
80 | ||
81 | //______________________________________________________________________________________________ | |
82 | AliShuttleStatus &AliShuttleStatus::operator=(const AliShuttleStatus &c) | |
83 | { | |
84 | // assigment operator | |
85 | ||
86 | if (this != &c) | |
87 | ((AliShuttleStatus &) c).Copy(*this); | |
88 | ||
89 | return *this; | |
90 | } | |
91 | ||
92 | //______________________________________________________________________________________________ | |
93 | void AliShuttleStatus::Copy(TObject& c) const | |
94 | { | |
95 | // copy function | |
96 | ||
97 | AliShuttleStatus& target = (AliShuttleStatus &) c; | |
98 | ||
99 | target.fTimeStamp = fTimeStamp; | |
100 | target.fStatus = fStatus; | |
101 | target.fCount = fCount; | |
102 | } | |
103 | ||
104 | //______________________________________________________________________________________________ | |
105 | void AliShuttleStatus::SetStatus(Status status) | |
106 | { | |
107 | // sets a new status, add the same time the timestamp is set to now | |
108 | ||
109 | fStatus = status; | |
110 | fTimeStamp = time(0); | |
111 | } | |
112 | ||
113 | //______________________________________________________________________________________________ | |
114 | const char* AliShuttleStatus::GetStatusName(Status status) | |
115 | { | |
116 | // returns a name (string) of the status | |
117 | ||
118 | switch (status) | |
119 | { | |
120 | case kInvalid: return "Invalid"; | |
121 | case kStarted: return "Started"; | |
122 | case kDCSStarted: return "DCSStarted"; | |
123 | case kDCSError: return "DCSError"; | |
124 | case kPPStarted: return "PPStarted"; | |
125 | case kPPError: return "PPError"; | |
126 | case kDone: return "Done"; | |
127 | case kFailed: return "Failed"; | |
128 | case kStoreFailed: return "StoreFailed"; | |
129 | } | |
130 | ||
131 | return 0; | |
132 | } |