]>
Commit | Line | Data |
---|---|---|
4a6b108b | 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$ | |
85a80aa9 | 18 | Revision 1.2 2006/08/15 10:50:00 jgrosseo |
19 | effc++ corrections (alberto) | |
20 | ||
4f0ab988 | 21 | Revision 1.1 2006/07/20 13:20:13 jgrosseo |
22 | introducing status management: The processing per subdetector is divided into several steps, | |
23 | after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle | |
24 | can keep track of the number of failures and skips further processing after a certain threshold is | |
25 | exceeded. These thresholds can be configured in LDAP. | |
26 | ||
4a6b108b | 27 | */ |
28 | ||
29 | // | |
30 | // This class stores the status of the Shuttle processing for a given run and a given detector | |
31 | // | |
32 | // This class stores the status of the processing, the number of retries and the timestamp of the last action | |
33 | // The detector and run number are stored using the CDB framework | |
34 | // | |
35 | // | |
36 | ||
37 | #include "AliShuttleStatus.h" | |
38 | ||
39 | ClassImp(AliShuttleStatus) | |
40 | ||
41 | AliShuttleStatus::AliShuttleStatus() : TObject(), | |
42 | fTimeStamp(0), | |
43 | fStatus(kInvalid), | |
44 | fCount(0) | |
45 | { | |
46 | // default constructor | |
47 | } | |
48 | ||
49 | AliShuttleStatus::AliShuttleStatus(Status status) : TObject(), | |
50 | fTimeStamp(0), | |
51 | fStatus(status), | |
52 | fCount(1) | |
53 | { | |
54 | // constructor | |
55 | ||
56 | fTimeStamp = time(0); | |
57 | } | |
58 | ||
4f0ab988 | 59 | AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : |
60 | TObject(c), fTimeStamp(0), | |
61 | fStatus(kInvalid), | |
62 | fCount(1) | |
4a6b108b | 63 | { |
64 | // copy constructor | |
65 | ||
66 | ((AliShuttleStatus &)c).Copy(*this); | |
67 | } | |
68 | ||
69 | AliShuttleStatus::~AliShuttleStatus() | |
70 | { | |
71 | // destructor | |
72 | } | |
73 | ||
74 | AliShuttleStatus &AliShuttleStatus::operator=(const AliShuttleStatus &c) | |
75 | { | |
76 | // assigment operator | |
77 | ||
78 | if (this != &c) | |
79 | ((AliShuttleStatus &) c).Copy(*this); | |
80 | ||
81 | return *this; | |
82 | } | |
83 | ||
84 | void AliShuttleStatus::Copy(TObject& c) const | |
85 | { | |
86 | // copy function | |
87 | ||
88 | AliShuttleStatus& target = (AliShuttleStatus &) c; | |
89 | ||
90 | target.fTimeStamp = fTimeStamp; | |
91 | target.fStatus = fStatus; | |
92 | target.fCount = fCount; | |
93 | } | |
94 | ||
95 | void AliShuttleStatus::SetStatus(Status status) | |
96 | { | |
97 | // sets a new status, add the same time the timestamp is set to now | |
98 | ||
99 | fStatus = status; | |
100 | fTimeStamp = time(0); | |
101 | } | |
102 | ||
103 | const char* AliShuttleStatus::GetStatusName(Status status) | |
104 | { | |
105 | // returns a name (string) of the status | |
106 | ||
107 | switch (status) | |
108 | { | |
109 | case kInvalid: return "Invalid"; | |
110 | case kStarted: return "Started"; | |
111 | case kDCSStarted: return "DCSStarted"; | |
112 | case kDCSError: return "DCSError"; | |
113 | case kPPStarted: return "PPStarted"; | |
114 | case kPPError: return "PPError"; | |
4a6b108b | 115 | case kDone: return "Done"; |
116 | case kFailed: return "Failed"; | |
85a80aa9 | 117 | case kStoreFailed: return "StoreFailed"; |
4a6b108b | 118 | } |
119 | ||
120 | return 0; | |
121 | } |