TensorFlow Serving C++ API Documentation
tensorflow_serving
core
resource_preserving_policy.h
1
/* Copyright 2016 Google Inc. All Rights Reserved.
2
3
Licensed under the Apache License, Version 2.0 (the "License");
4
you may not use this file except in compliance with the License.
5
You may obtain a copy of the License at
6
7
http://www.apache.org/licenses/LICENSE-2.0
8
9
Unless required by applicable law or agreed to in writing, software
10
distributed under the License is distributed on an "AS IS" BASIS,
11
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
See the License for the specific language governing permissions and
13
limitations under the License.
14
==============================================================================*/
15
16
#ifndef TENSORFLOW_SERVING_CORE_RESOURCE_PRESERVING_POLICY_H_
17
#define TENSORFLOW_SERVING_CORE_RESOURCE_PRESERVING_POLICY_H_
18
19
#include <vector>
20
21
#include "absl/types/optional.h"
22
#include "tensorflow_serving/core/aspired_version_policy.h"
23
#include "tensorflow_serving/core/loader_harness.h"
24
25
namespace
tensorflow {
26
namespace
serving {
27
28
// ServablePolicy that eagerly unloads any no-longer-aspired versions of a
29
// servable stream and only after done unloading, loads newly aspired versions
30
// in the order of descending version number.
31
//
32
// This policy minimizes resource consumption with the trade-off of temporary
33
// servable unavailability while all old versions unload followed by the new
34
// versions loading.
35
//
36
// Servables with a single version consuming the majority of their host's
37
// resources must use this policy to prevent deadlock. Other typical use-cases
38
// will be for multi-servable environments where clients can tolerate brief
39
// interruptions to a single servable's availability on a replica.
40
//
41
// NB: This policy does not in any way solve cross-replica availability.
42
class
ResourcePreservingPolicy
final :
public
AspiredVersionPolicy
{
43
public
:
44
absl::optional<ServableAction>
GetNextAction
(
45
const
std::vector<AspiredServableStateSnapshot>& all_versions)
46
const override
;
47
};
48
49
}
// namespace serving
50
}
// namespace tensorflow
51
52
#endif
// TENSORFLOW_SERVING_CORE_RESOURCE_PRESERVING_POLICY_H_
tensorflow::serving::AspiredVersionPolicy
Definition:
aspired_version_policy.h:48
tensorflow::serving::ResourcePreservingPolicy
Definition:
resource_preserving_policy.h:42
tensorflow::serving::ResourcePreservingPolicy::GetNextAction
absl::optional< ServableAction > GetNextAction(const std::vector< AspiredServableStateSnapshot > &all_versions) const override
Definition:
resource_preserving_policy.cc:25
Generated by
1.9.1