TensorFlow Serving C++ API Documentation
availability_test_util.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 // Methods related to the availability of servables, that are useful in writing
17 // tests. (Not intended for production use.)
18 
19 #ifndef TENSORFLOW_SERVING_CORE_TEST_UTIL_AVAILABILITY_TEST_UTIL_H_
20 #define TENSORFLOW_SERVING_CORE_TEST_UTIL_AVAILABILITY_TEST_UTIL_H_
21 
22 #include "tensorflow_serving/core/servable_state_monitor.h"
23 
24 namespace tensorflow {
25 namespace serving {
26 namespace test_util {
27 
28 // Waits until 'monitor' shows that the manager state of 'servable' is one of
29 // 'states'.
30 void WaitUntilServableManagerStateIsOneOf(
31  const ServableStateMonitor& monitor, const ServableId& servable,
32  const std::vector<ServableState::ManagerState>& states);
33 
34 // Waits until 'monitor' shows that the manager state servable ids is
35 // kAvailable.
36 void WaitUntilVersionsAvailable(const ServableStateMonitor& monitor,
37  const string& servable_id_name,
38  absl::Span<const int64_t> servable_id_versions);
39 
40 } // namespace test_util
41 } // namespace serving
42 } // namespace tensorflow
43 
44 #endif // TENSORFLOW_SERVING_CORE_TEST_UTIL_AVAILABILITY_TEST_UTIL_H_