]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
introducing status management: The processing per subdetector is divided into several...
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jul 2006 13:20:13 +0000 (13:20 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jul 2006 13:20:13 +0000 (13:20 +0000)
after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
can keep track of the number of failures and skips further processing after a certain threshold is
exceeded. These thresholds can be configured in LDAP.

SHUTTLE/AliShuttleStatus.cxx [new file with mode: 0644]
SHUTTLE/AliShuttleStatus.h [new file with mode: 0644]

diff --git a/SHUTTLE/AliShuttleStatus.cxx b/SHUTTLE/AliShuttleStatus.cxx
new file mode 100644 (file)
index 0000000..523770c
--- /dev/null
@@ -0,0 +1,109 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+//
+// This class stores the status of the Shuttle processing for a given run and a given detector
+//
+// This class stores the status of the processing, the number of retries and the timestamp of the last action
+// The detector and run number are stored using the CDB framework
+//
+//
+
+#include "AliShuttleStatus.h"
+
+ClassImp(AliShuttleStatus)
+
+AliShuttleStatus::AliShuttleStatus() : TObject(),
+  fTimeStamp(0),
+  fStatus(kInvalid),
+  fCount(0)
+{
+  // default constructor
+}
+
+AliShuttleStatus::AliShuttleStatus(Status status) : TObject(),
+  fTimeStamp(0),
+  fStatus(status),
+  fCount(1)
+{
+  // constructor
+
+  fTimeStamp = time(0);
+}
+
+AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : TObject(c)
+{
+  // copy constructor
+
+  ((AliShuttleStatus &)c).Copy(*this);
+}
+
+AliShuttleStatus::~AliShuttleStatus()
+{
+  // destructor
+}
+
+AliShuttleStatus &AliShuttleStatus::operator=(const AliShuttleStatus &c)
+{
+  // assigment operator
+
+  if (this != &c) 
+    ((AliShuttleStatus &) c).Copy(*this);
+
+  return *this;
+}
+
+void AliShuttleStatus::Copy(TObject& c) const
+{
+  // copy function
+
+  AliShuttleStatus& target = (AliShuttleStatus &) c;
+
+  target.fTimeStamp = fTimeStamp;
+  target.fStatus = fStatus;
+  target.fCount = fCount;
+}
+
+void AliShuttleStatus::SetStatus(Status status)
+{
+  // sets a new status, add the same time the timestamp is set to now
+
+  fStatus = status;
+  fTimeStamp = time(0);
+}
+
+const char* AliShuttleStatus::GetStatusName(Status status)
+{
+  // returns a name (string) of the status
+
+  switch (status)
+  {
+    case kInvalid: return "Invalid";
+    case kStarted: return "Started";
+    case kDCSStarted: return "DCSStarted";
+    case kDCSError: return "DCSError";
+    case kPPStarted: return "PPStarted";
+    case kPPError: return "PPError";
+    case kPPDone: return "PPDone";
+    case kDone: return "Done";
+    case kFailed: return "Failed";
+  }
+
+  return 0;
+}
diff --git a/SHUTTLE/AliShuttleStatus.h b/SHUTTLE/AliShuttleStatus.h
new file mode 100644 (file)
index 0000000..d9e6ede
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef ALISHUTTLESTATUS_H
+#define ALISHUTTLESTATUS_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//
+// This class stores the status of the Shuttle processing for a given run and a given detector
+//
+
+#include <TObject.h>
+
+class AliShuttleStatus : public TObject
+{
+public:
+  enum Status {
+    kInvalid = 0,
+    kStarted,
+    kDCSStarted,
+    kDCSError,
+    kPPStarted,
+    kPPError,
+    kPPDone,
+    kDone, // final
+    kFailed  // final
+    // TODO see if one can add status of storage here
+  };
+
+  AliShuttleStatus();
+  AliShuttleStatus(const AliShuttleStatus& c);
+
+  ~AliShuttleStatus();
+
+  AliShuttleStatus& operator=(const AliShuttleStatus& c);
+  virtual void Copy(TObject& c) const;
+
+  AliShuttleStatus(Status status);
+
+  UInt_t GetTimeStamp() const { return fTimeStamp; }
+  void SetTimeStamp(UInt_t timeStamp) { fTimeStamp = timeStamp; }
+
+  Status GetStatus() const { return fStatus; }
+  const char* GetStatusName() const { return GetStatusName(fStatus); }
+  void SetStatus(Status status);
+
+  Int_t GetCount() const { return fCount; }
+  void SetCount(Int_t count) { fCount = count; }
+  void IncreaseCount() { fCount++; }
+
+  static const char* GetStatusName(Status status);
+
+protected:
+  UInt_t fTimeStamp;    // timestamp of the last change
+  Status fStatus;       // status of the processing
+  Int_t fCount;         // number of retries
+
+  ClassDef(AliShuttleStatus, 1);
+};
+
+#endif