tensorflow::serving::AspiredVersionPolicy

This is an abstract class.

#include <aspired_version_policy.h>

An interface for the policy to be applied for transitioning servable versions in a servable stream.

Summary

Policies should be entirely stateless and idempotent. Asking the same policy multiple times for the next action, for an identical vector of AspiredServableStateSnapshots, should return the same result.

If additional state is required to implement a Policy, such state shall be shared via AspiredServableStateSnapshots. Depending on the kind of state, the most likely candidates for originating or tracking state are Sources or the Harness and Manager.

Constructors and Destructors

~AspiredVersionPolicy()

Public types

Action{
  kLoad,
  kUnload
}
enum
The different actions that could be recommended by a policy.

Public functions

GetNextAction(const std::vector< AspiredServableStateSnapshot > & all_versions) const =0
virtual absl::optional< ServableAction >
Takes in a vector of state snapshots of all versions of a servable stream and returns an action to be performed for a particular servable version, depending only on the states of all the versions.

Protected static functions

GetHighestAspiredNewServableId(const std::vector< AspiredServableStateSnapshot > & all_versions)
absl::optional< ServableId >
Returns the aspired ServableId with the highest version that matches kNew state, if any exists.

Structs

tensorflow::serving::AspiredVersionPolicy::ServableAction

Action and the id of the servable associated with it.

Public types

Action

 Action

The different actions that could be recommended by a policy.

Properties
kLoad

Call load on the servable.

kUnload

Call unload on the servable.

Public functions

GetNextAction

virtual absl::optional< ServableAction > GetNextAction(
  const std::vector< AspiredServableStateSnapshot > & all_versions
) const =0

Takes in a vector of state snapshots of all versions of a servable stream and returns an action to be performed for a particular servable version, depending only on the states of all the versions.

If no action is to be performed, we don't return an action, meaning that the servable stream is up to date.

~AspiredVersionPolicy

virtual  ~AspiredVersionPolicy()=default

Protected static functions

GetHighestAspiredNewServableId

absl::optional< ServableId > GetHighestAspiredNewServableId(
  const std::vector< AspiredServableStateSnapshot > & all_versions
)

Returns the aspired ServableId with the highest version that matches kNew state, if any exists.