DDS  ver. 1.6
SSHScheduler.h
Go to the documentation of this file.
1 // Copyright 2014 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 #ifndef __DDS__SSHScheduler__
6 #define __DDS__SSHScheduler__
7 
8 // DDS
9 #include "AgentChannel.h"
10 #include "Task.h"
11 #include "Topology.h"
12 // STD
13 #include <vector>
14 
15 namespace dds
16 {
17  namespace commander_cmd
18  {
20  {
21  public:
22  struct SSchedule
23  {
25  : m_taskID(0)
26  , m_taskInfo()
27  , m_channel()
28  {
29  }
30 
31  uint64_t m_taskID;
34  };
35 
36  typedef std::vector<SSchedule> ScheduleVector_t;
37  typedef std::map<size_t, std::vector<uint64_t>, std::greater<size_t>> CollectionMap_t;
38 
39  private:
40  // Map pair<host name, worker id> to vector of channel indeces.
41  typedef std::map<std::pair<std::string, std::string>, std::vector<size_t>> hostToChannelMap_t;
42 
43  public:
44  CSSHScheduler();
46 
47  void makeSchedule(const topology_api::CTopology& _topology,
49 
50  void makeSchedule(const topology_api::CTopology& _topology,
52  const topology_api::CTopology::HashSet_t& _addedTasks,
53  const topology_api::CTopology::HashSet_t& _addedCollections);
54 
55  const ScheduleVector_t& getSchedule() const;
56 
57  static bool hostPatternMatches(const std::string& _hostPattern, const std::string& _host);
58 
59  std::string toString();
60 
61  private:
62  void makeScheduleImpl(const topology_api::CTopology& _topology,
64  const topology_api::CTopology::HashSet_t* _addedTasks,
65  const topology_api::CTopology::HashSet_t* _addedCollections);
66 
67  void scheduleCollections(const topology_api::CTopology& _topology,
69  hostToChannelMap_t& _hostToChannelMap,
70  std::set<uint64_t>& _scheduledTasks,
71  const CollectionMap_t& _collectionMap,
72  bool useRequirement);
73 
74  void scheduleTasks(const topology_api::CTopology& _topology,
76  hostToChannelMap_t& _hostToChannelMap,
77  std::set<uint64_t>& _scheduledTasks,
78  const std::set<uint64_t>& _tasksInCollections,
79  bool useRequirement,
80  const topology_api::CTopology::HashSet_t* _addedTasks);
81 
82  private:
83  ScheduleVector_t m_schedule;
84  };
85  }
86 }
87 
88 #endif /* defined(__DDS__SSHScheduler__) */
SSchedule()
Definition: SSHScheduler.h:24
uint64_t m_taskID
Definition: SSHScheduler.h:31
~CSSHScheduler()
Definition: SSHScheduler.cpp:21
static bool hostPatternMatches(const std::string &_hostPattern, const std::string &_host)
Definition: SSHScheduler.cpp:276
CSSHScheduler()
Definition: SSHScheduler.cpp:17
std::weak_ptr< CAgentChannel > weakConnectionPtr_t
Definition: BaseChannelImpl.h:193
Definition: Topology.h:27
std::string toString()
Definition: SSHScheduler.cpp:284
std::set< uint64_t > HashSet_t
Definition: Topology.h:63
Definition: dds-agent/src/AgentConnectionManager.h:16
Definition: Topology.h:42
topology_api::STaskInfo m_taskInfo
Definition: SSHScheduler.h:32
std::map< size_t, std::vector< uint64_t >, std::greater< size_t > > CollectionMap_t
Definition: SSHScheduler.h:37
std::vector< SSchedule > ScheduleVector_t
Definition: SSHScheduler.h:36
CAgentChannel::weakConnectionPtr_t m_channel
Definition: SSHScheduler.h:33
std::vector< weakConnectionPtr_t > weakConnectionPtrVector_t
Definition: BaseChannelImpl.h:195
Definition: SSHScheduler.h:19
const ScheduleVector_t & getSchedule() const
Definition: SSHScheduler.cpp:271
void makeSchedule(const topology_api::CTopology &_topology, const CAgentChannel::weakConnectionPtrVector_t &_channels)
Definition: SSHScheduler.cpp:25