WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
BatchJobSet.h
1 
10 #ifndef WRENCH_BATCHJOBSET_H
11 #define WRENCH_BATCHJOBSET_H
12 
13 #include <wrench/services/compute/batch/BatchJob.h>
14 
15 namespace wrench {
16 
17  /***********************/
19  /***********************/
20 
24  class BatchJobSet {
25 
26  public:
27 
28  BatchJobSet() = default;
29 
31  std::set<std::shared_ptr<BatchJob>> jobs;
33  unsigned long num_nodes_utilized = 0;
34 
40  BatchJobSet& operator += (const BatchJobSet& right)
41  {
42  for (const auto &j : right.jobs) {
43  add(j);
44  }
45  return *this;
46  }
47 
53  BatchJobSet& operator -= (const BatchJobSet& right)
54  {
55  for (const auto &j : right.jobs) {
56  remove(j);
57  }
58  return *this;
59  }
60 
65  void inline add(std::shared_ptr<BatchJob> job) {
66  if (this->jobs.find(job) == this->jobs.end()) {
67  num_nodes_utilized += job->getRequestedNumNodes();
68  this->jobs.insert(job);
69  }
70  }
71 
76  void inline remove(std::shared_ptr<BatchJob> job) {
77  if (this->jobs.find(job) != this->jobs.end()) {
78  num_nodes_utilized -= job->getRequestedNumNodes();
79  this->jobs.erase(job);
80  }
81  }
82 
83  };
84 
85  /***********************/
87  /***********************/
88 
89 }
90 
91 #endif //WRENCH_BATCHJOBSET_H
wrench
Definition: Alarm.cpp:20