• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_PS_CORE_NODE_INFO_H_
18 #define MINDSPORE_CCSRC_PS_CORE_NODE_INFO_H_
19 
20 #include <string>
21 
22 #include "proto/comm.pb.h"
23 #include "proto/ps.pb.h"
24 
25 namespace mindspore {
26 namespace ps {
27 namespace core {
28 // Events reported to the business layer, include cluster event and node event.
29 enum class ClusterEvent {
30   NODE_TIMEOUT = 1,
31   SCHEDULER_TIMEOUT = 2,
32   READY_FOR_SCALE_OUT = 3,
33   READY_FOR_SCALE_IN = 4,
34   CLUSTER_SCALE_OUT_DONE = 5,
35   CLUSTER_SCALE_IN_DONE = 6
36 };
37 
38 struct NodeInfo {
NodeInfoNodeInfo39   NodeInfo() : ip_(""), port_(0), node_role_(NodeRole::SCHEDULER), rank_id_(UINT32_MAX), is_alive(false) {}
40   // ip
41   std::string ip_;
42   // the port of this node
43   uint16_t port_;
44   // the current Node unique id:0,1,2...
45   std::string node_id_;
46   // the role of the node: worker,server,scheduler
47   NodeRole node_role_;
48   // the current Node rank id,the worker node range is:[0,numOfWorker-1], the server node range is:[0, numOfServer-1]
49   uint32_t rank_id_;
50 
51   // After the node registration is successful, it is alive.If the node's heartbeat times out, then it is not alive
52   bool is_alive;
53 };
54 }  // namespace core
55 }  // namespace ps
56 }  // namespace mindspore
57 #endif  // MINDSPORE_CCSRC_PS_CORE_NODE_INFO_H_
58