DDS  ver. 2.0
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 "ChannelInfo.h"
11 #include "Task.h"
12 #include "Topology.h"
13 // STD
14 #include <vector>
15 
16 namespace dds
17 {
18  namespace commander_cmd
19  {
21  {
22  public:
23  struct SSchedule
24  {
26  : m_taskID(0)
27  {
28  }
29 
30  uint64_t m_taskID;
33  };
34 
35  typedef std::vector<SSchedule> ScheduleVector_t;
36  typedef std::map<size_t, std::vector<uint64_t>, std::greater<size_t>> CollectionMap_t;
37  typedef std::vector<dds::protocol_api::SWeakChannelInfo<CAgentChannel>> weakChannelInfoVector_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, const weakChannelInfoVector_t& _channels);
48 
49  void makeSchedule(const topology_api::CTopology& _topology,
50  const weakChannelInfoVector_t& _channels,
51  const topology_api::CTopology::HashSet_t& _addedTasks,
52  const topology_api::CTopology::HashSet_t& _addedCollections);
53 
54  const ScheduleVector_t& getSchedule() const;
55 
56  static bool hostPatternMatches(const std::string& _hostPattern, const std::string& _host);
57 
58  std::string toString();
59 
60  private:
61  void makeScheduleImpl(const topology_api::CTopology& _topology,
62  const weakChannelInfoVector_t& _channels,
63  const topology_api::CTopology::HashSet_t* _addedTasks,
64  const topology_api::CTopology::HashSet_t* _addedCollections);
65 
66  void scheduleCollections(const topology_api::CTopology& _topology,
67  const weakChannelInfoVector_t& _channels,
68  hostToChannelMap_t& _hostToChannelMap,
69  std::set<uint64_t>& _scheduledTasks,
70  const CollectionMap_t& _collectionMap,
71  bool useRequirement);
72 
73  void scheduleTasks(const topology_api::CTopology& _topology,
74  const weakChannelInfoVector_t& _channels,
75  hostToChannelMap_t& _hostToChannelMap,
76  std::set<uint64_t>& _scheduledTasks,
77  const std::set<uint64_t>& _tasksInCollections,
78  bool useRequirement,
79  const topology_api::CTopology::HashSet_t* _addedTasks);
80 
81  private:
82  ScheduleVector_t m_schedule;
83  };
84  }
85 }
86 
87 #endif /* defined(__DDS__SSHScheduler__) */
SSchedule()
Definition: SSHScheduler.h:25
void makeSchedule(const topology_api::CTopology &_topology, const weakChannelInfoVector_t &_channels)
Definition: SSHScheduler.cpp:25
uint64_t m_taskID
Definition: SSHScheduler.h:30
~CSSHScheduler()
Definition: SSHScheduler.cpp:21
dds::protocol_api::SWeakChannelInfo< CAgentChannel > m_weakChannelInfo
Definition: SSHScheduler.h:32
static bool hostPatternMatches(const std::string &_hostPattern, const std::string &_host)
Definition: SSHScheduler.cpp:277
CSSHScheduler()
Definition: SSHScheduler.cpp:17
Definition: Topology.h:27
std::vector< dds::protocol_api::SWeakChannelInfo< CAgentChannel > > weakChannelInfoVector_t
Definition: SSHScheduler.h:37
std::string toString()
Definition: SSHScheduler.cpp:285
std::set< uint64_t > HashSet_t
Definition: Topology.h:63
Definition: dds-agent/src/AgentConnectionManager.h:18
Definition: Topology.h:42
topology_api::STaskInfo m_taskInfo
Definition: SSHScheduler.h:31
std::map< size_t, std::vector< uint64_t >, std::greater< size_t > > CollectionMap_t
Definition: SSHScheduler.h:36
std::vector< SSchedule > ScheduleVector_t
Definition: SSHScheduler.h:35
Definition: ChannelInfo.h:39
Definition: SSHScheduler.h:20
const ScheduleVector_t & getSchedule() const
Definition: SSHScheduler.cpp:272