• 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_WORKER_NODE_H_
18 #define MINDSPORE_CCSRC_PS_CORE_WORKER_NODE_H_
19 
20 #include <cstdlib>
21 #include <iostream>
22 #include <memory>
23 #include <string>
24 #include <utility>
25 #include <algorithm>
26 
27 #include "ps/core/cluster_config.h"
28 #include "ps/core/communicator/tcp_client.h"
29 #include "ps/core/communicator/tcp_server.h"
30 #include "ps/core/abstract_node.h"
31 
32 namespace mindspore {
33 namespace ps {
34 namespace core {
35 class WorkerNode : public AbstractNode {
36  public:
37   WorkerNode() = default;
38   ~WorkerNode() override = default;
39 
40   bool Start(const uint32_t &timeout = PSContext::instance()->cluster_config().cluster_available_timeout) override;
41   bool Stop() override;
42   bool Finish(const uint32_t &timeout = kTimeoutInSeconds) override;
43 
44  private:
45   void Initialize();
46 };
47 }  // namespace core
48 }  // namespace ps
49 }  // namespace mindspore
50 
51 #endif  // MINDSPORE_CCSRC_PS_CORE_WORKER_NODE_H_
52