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 ON_PREPARE_PERSIST = 7, 37 ON_BEGIN_PERSIST = 8, 38 ON_SEND_META_DATA = 9, 39 CLUSTER_SCALE_OUT_ROLLBACK_DONE = 10 40 }; 41 42 struct NodeInfo { NodeInfoNodeInfo43 NodeInfo() : ip_(""), port_(0), node_role_(NodeRole::SCHEDULER), rank_id_(UINT32_MAX), is_alive(false) {} 44 // ip 45 std::string ip_; 46 // the port of this node 47 uint16_t port_; 48 // the current Node unique id:0,1,2... 49 std::string node_id_; 50 // the role of the node: worker,server,scheduler 51 NodeRole node_role_; 52 // the current Node rank id,the worker node range is:[0,numOfWorker-1], the server node range is:[0, numOfServer-1] 53 uint32_t rank_id_; 54 // After the node registration is successful, it is alive.If the node's heartbeat times out, then it is not alive 55 bool is_alive; 56 }; 57 } // namespace core 58 } // namespace ps 59 } // namespace mindspore 60 #endif // MINDSPORE_CCSRC_PS_CORE_NODE_INFO_H_ 61