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