workflow.h 1.5 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#include <string>
W
wangguibao 已提交
17 18 19 20 21 22 23 24
#include "common/inner_common.h"
#include "framework/dag.h"
#include "framework/dag_view.h"

namespace baidu {
namespace paddle_serving {
namespace predictor {

W
wangguibao 已提交
25
template <typename T>
W
wangguibao 已提交
26 27 28
class Manager;

class Workflow {
W
wangguibao 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41
 public:
  Workflow() {}

  static const char* tag() { return "workflow"; }

  // Each workflow object corresponds to an independent
  // configure file, so you can share the object between
  // different apps.
  int init(const configure::Workflow& conf);

  DagView* fetch_dag_view(const std::string& service_name);

  int deinit() { return 0; }
W
wangguibao 已提交
42

W
wangguibao 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  void return_dag_view(DagView* view);

  int reload();

  const std::string& name() { return _name; }

  const std::string& full_name() { return _name; }

  void regist_metric(const std::string& service_name);

 private:
  Dag _dag;
  std::string _type;
  std::string _name;
};
W
wangguibao 已提交
58

W
wangguibao 已提交
59 60 61
}  // namespace predictor
}  // namespace paddle_serving
}  // namespace baidu