# wallaroo.pipeline

def update_timestamp(f):
class Pipeline(wallaroo.object.Object):

A pipeline is an execution context for models. Pipelines contain Steps, which are often Models. Pipelines can be deployed or undeployed.

Pipeline(client: Optional[wallaroo.client.Client], data: Dict[str, Any])

Base constructor.

Each object requires:

• a GraphQL client - in order to fill its missing members dynamically
• an initial data blob - typically from unserialized JSON, contains at
• least the data for required members (typically the object's primary key) and optionally other data members.
def builder
def id(self) -> int:
def owner_id(*args, **kwargs):
def create_time(*args, **kwargs):
def last_update_time(*args, **kwargs):
def name(*args, **kwargs):
def variants(*args, **kwargs):
def tags(*args, **kwargs):
def logs( self, limit: int = 100, valid: Optionalbool] = None) -> [wallaroo.logs.LogEntries:
def logs_shadow_deploy(self):
def url(self) -> str:

Returns the inference URL for this pipeline.

Deploy pipeline. pipeline_name is optional if deploy was called previously. When specified, pipeline_name must be ASCII alpha-numeric characters, plus dash (-) only.

def definition(self) -> str:

Get the current definition of the pipeline as a string

def get_topic_name(self) -> str:
def undeploy(self
def infer(self, *args, **kwargs):

Returns an inference result on this deployment, given a tensor.

def infer_from_file(self, *args, **kwargs):

Returns an inference result on this deployment, given tensors in a file.

async def batch_infer_from_file]:

Async method to run batched inference on a data file for a given deployment.

###### Parameters
• str filename: path to an existing file with tensor data in JSON format.
• str data_key: key which the tensor data is under within the JSON. defaults to "tensor".
• int batch_size: batch size to use when sending requests to the engine. defaults to 1000.
• int connector_limit: limit for the amount of TCP connections. defaults to 4.
###### Returns

List of InferenceResult's.

def status(self) -> Dict[str, Any]:

Status of pipeline

def steps(self) -> List[wallaroo.pipeline_config.Step]:

Returns a list of the steps of a pipeline. Not exactly a shim

def model_configs(self]:

Returns a list of the model configs of a pipeline. Not exactly a shim

def remove_step(self, index: int

Remove a step at a given index

def add_model_step(self, model: wallaroo.model.Model

Perform inference with a single model.

def replace_with_model_step( self, index: int, model: wallaroo.model.Model

Replaces the step at the given index with a model step

def add_multi_model_step( self, models: Iterable[wallaroo.model.Model]

Perform inference on the same input data for any number of models.

def replace_with_multi_model_step( self, index: int, models: Iterable[wallaroo.model.Model]

Replaces the step at the index with a multi model step

def add_audit(self, slice

Run audit logging on a specified slice of model outputs.

The slice must be in python-like format. start:, start:end, and :end are supported.

def replace_with_audit(self, index: int, audit_slice: str

Replaces the step at the index with an audit step

def add_select(self, index: int

Select only the model output with the given index from an array of outputs.

def replace_with_select(self, step_index: int, select_index: int

Replaces the step at the index with a select step

def add_key_split( self, default: wallaroo.model.Model, meta_key: str, options: Dictstr, [wallaroo.model.Model]

Split traffic based on the value at a given meta_key in the input data, routing to the appropriate model.

If the resulting value is a key in options, the corresponding model is used. Otherwise, the default model is used for inference.

def replace_with_key_split( self, index: int, default: wallaroo.model.Model, meta_key: str, options: Dictstr, [wallaroo.model.Model]

Replace the step at the index with a key split step

def add_random_split( self, weighted: IterableTuple[float, [wallaroo.model.Model]], hash_key: Optional[str] = None

Routes inputs to a single model, randomly chosen from the list of weighted options.

Each model receives inputs that are approximately proportional to the weight it is assigned. For example, with two models having weights 1 and 1, each will receive roughly equal amounts of inference inputs. If the weights were changed to 1 and 2, the models would receive roughly 33% and 66% respectively instead.

When choosing the model to use, a random number between 0.0 and 1.0 is generated. The weighted inputs are mapped to that range, and the random input is then used to select the model to use. For example, for the two-models equal-weight case, a random key of 0.4 would route to the first model. 0.6 would route to the second.

To support consistent assignment to a model, a hash_key can be specified. This must be between 0.0 and 1.0. The value at this key, when present in the input data, will be used instead of a random number for model selection.

def replace_with_random_split( self, index: int, weighted: IterableTuple[float, [wallaroo.model.Model]], hash_key: Optional[str] = None

Replace the step at the index with a random split step

def add_shadow_deploy( self, champion: wallaroo.model.Model, challengers: Iterable[wallaroo.model.Model]

Create a "shadow deployment" experiment pipeline. The champion model and all challengers are run for each input. The result data for all models is logged, but the output of the champion is the only result returned.

This is particularly useful for "burn-in" testing a new model with real world data without displacing the currently proven model.

This is currently implemented as three steps: A multi model step, an audit step, and a select step. To remove or replace this step, you need to remove or replace all three. You can remove steps using pipeline.remove_step

def replace_with_shadow_deploy( self, index: int, champion: wallaroo.model.Model, challengers: Iterable[wallaroo.model.Model]

Replace a given step with a shadow deployment

def add_validation( self, name: str, validation: wallaroo.checks.Expression

Add a validation with the given name. All validations are run on all outputs, and all failures are logged.

def add_alert( self, name: str, alert: wallaroo.checks.Alert, notifications: List[wallaroo.notify.Notification]
def replace_with_alert( self, index: int, name: str, alert: wallaroo.checks.Alert, notifications: List[wallaroo.notify.Notification]

Replace the step at the given index with the specified alert

def clear(self

Remove all steps from the pipeline. This might be desireable if replacing models, for example.

def list_explainability_configs(self]:

List the explainability configs we've created.

def get_explainability_config( self,]

Get the details of an explainability config.

def create_explainability_config(self, feature_names: Sequence[str], num_points=10):

Create a shap config to be used later for reference and adhoc requests.

class Pipelines(typing.List[wallaroo.pipeline.Pipeline]):

Wraps a list of pipelines for display in a display-aware environment like Jupyter.

builtins.list
list
clear
copy
append
insert
extend
pop
remove
index
count
reverse
sort