job_counters.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #include "fwd.h"
  3. #include <yt/cpp/mapreduce/interface/node.h>
  4. namespace NYT {
  5. class TJobCounter
  6. {
  7. private:
  8. TNode Data_;
  9. ui64 Total_ = 0;
  10. public:
  11. TJobCounter() = default;
  12. TJobCounter(TNode data);
  13. TJobCounter(ui64 total);
  14. ui64 GetTotal() const;
  15. ui64 GetValue(const TStringBuf key) const;
  16. };
  17. /// Class representing a collection of job counters.
  18. class TJobCounters
  19. {
  20. public:
  21. ///
  22. /// Construct empty counter.
  23. TJobCounters() = default;
  24. ///
  25. /// Construct counter from counters node.
  26. TJobCounters(const NYT::TNode& counters);
  27. const TJobCounter& GetAborted() const;
  28. const TJobCounter& GetAbortedScheduled() const;
  29. const TJobCounter& GetAbortedNonScheduled() const;
  30. const TJobCounter& GetCompleted() const;
  31. const TJobCounter& GetCompletedNonInterrupted() const;
  32. const TJobCounter& GetCompletedInterrupted() const;
  33. const TJobCounter& GetLost() const;
  34. const TJobCounter& GetInvalidated() const;
  35. const TJobCounter& GetFailed() const;
  36. const TJobCounter& GetRunning() const;
  37. const TJobCounter& GetSuspended() const;
  38. const TJobCounter& GetPending() const;
  39. const TJobCounter& GetBlocked() const;
  40. ui64 GetTotal() const;
  41. private:
  42. ui64 Total_ = 0;
  43. TJobCounter Aborted_;
  44. TJobCounter AbortedScheduled_;
  45. TJobCounter AbortedNonScheduled_;
  46. TJobCounter Completed_;
  47. TJobCounter CompletedNonInterrupted_;
  48. TJobCounter CompletedInterrupted_;
  49. TJobCounter Lost_;
  50. TJobCounter Invalidated_;
  51. TJobCounter Failed_;
  52. TJobCounter Running_;
  53. TJobCounter Suspended_;
  54. TJobCounter Pending_;
  55. TJobCounter Blocked_;
  56. };
  57. ////////////////////////////////////////////////////////////////////
  58. } // namespace NYT