MCPcopy Create free account
hub / github.com/dmlc/parameter_server / Executor

Class Executor

src/system/executor.h:24–93  ·  view source on GitHub ↗

Maintain all remote nodes for a customer. It has its own thread to process received tasks.

Source from the content-addressed store, hash-verified

22// Maintain all remote nodes for a customer. It has its own thread to process
23// received tasks.
24class Executor {
25 public:
26 Executor(Customer& obj);
27 ~Executor();
28
29 // wake up the processing thread
30 void notify() { Lock l(recved_msg_mu_); dag_cond_.notify_one(); }
31
32 // mark this message as finshed in executor
33 void finish(const MessagePtr& msg);
34
35 // stop the processing thread
36 void stop();
37
38 // accessors
39 RNode* rnode(const NodeID& k);
40 std::vector<RNode*>& group(const NodeID& k);
41 const std::vector<Range<Key>>& keyRanges(const NodeID& k);
42 const Node& myNode() { return my_node_; }
43
44 void add(const Node& node);
45 // void remove(const Node& node);
46 void copyNodesFrom(const Executor& other);
47
48 // will be called by postoffice's receiving thread
49 // or the thread call wk->submit
50 void accept(const MessagePtr& msg);
51 // last received message
52 MessagePtr activeMessage() { return active_msg_; }
53 string lastRecvReply();
54
55 Customer& obj() { return obj_; }
56 private:
57 void run();
58
59 Customer& obj_;
60 // Temporal buffer for received messages
61 std::list<MessagePtr> recved_msgs_;
62 std::mutex recved_msg_mu_;
63 // the message is going to be processed or is the last one be processed
64 MessagePtr active_msg_;
65 std::condition_variable dag_cond_;
66
67 std::vector<NodeID> groupIDs() {
68 std::vector<NodeID> ids = {
69 kServerGroup, kWorkerGroup, kCompGroup,
70 kReplicaGroup, kOwnerGroup, kLiveGroup};
71 return ids;
72 }
73
74 struct NodeInfo {
75 NodeInfo() { };
76 ~NodeInfo() { delete node; }
77
78 void addSubNode(RNode* s);
79 void removeSubNode(RNode* s);
80
81 RNode* node = NULL;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected