ServiceDefinition
Class ServiceDefinition
azureml.deploy.operationalization.ServiceDefinition(name, op)
Bases: azureml.deploy.operationalization.OperationalizationDefinition
Service class defining a standard service's properties for publishing.
alias(alias)
Set the optional service function name alias to use in order to consume the service.
Example:
service = client.service('score-service').alias('score').deploy()
# `score()` is the function that will call the `score-service`
result = service.score()
Arguments
alias
The service function name alias to use in order to consume the service.
Returns
Self OperationalizationDefinition
for fluent API.
artifact
artifact(artifact)
Define a service's optional supported file artifact by name. A
convenience to calling .artifacts(['file.png'])
with a list of one.
Arguments
artifact
A single file artifact by name.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
artifacts
artifacts(artifacts)
Defines a service's optional supported file artifacts by name.
Arguments
artifacts
A list
of file artifacts by name.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
code_fn
code_fn(code, init=None)
Set the service consume function as a function.
Example:
def init():
pass
def score(df):
pass
.code_fn(score, init)
Arguments
code
A function handle as a reference to run python code.
init
An optional function handle as a reference to initialize the service.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
code_str
code_str(code, init=None)
Set the service consume function as a block of python code as a str
.
init = 'import pandas as pd'
code = 'print(pd)'
.code_str(code, init)
Arguments
code
A block of python code as a str
.
init
An optional block of python code as a str
to initialize
the service.
Returns
A ServiceDefinition
for fluent API chaining.
deploy
deploy()
Bundle up the definition properties and publish the service.
Returns
A new instance of Service
representing the
service deployed.
description
description(description)
Set the service's optional description.
Arguments
description
The description of the service.
Returns
Self OperationalizationDefinition
for fluent API.
inputs
inputs(**inputs)
Defines a service's optional supported inputs by name and type.
Example:
.inputs(a=float, b=int, c=str, d=bool, e='pandas.DataFrame')
Arguments
inputs
The inputs by name and type.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
models
models(**models)
Include any model(s) used for this service.
Example:
cars_model = rx_lin_mod(formula="am ~ hp + wt",data=mtcars)
.models(cars_model=cars_model)
Arguments
models
Any models by name and value.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
objects
objects(**objects)
Include any object(s) used for this service.
Example:
x = 5
y = 'hello'
.objects(x=x, y=y)
Arguments
objects
Any objects by name and value.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
outputs
outputs(**outputs)
Defines a service's optional supported outputs by name and type.
Example:
.outputs(a=float, b=int, c=str, d=bool, e='pandas.DataFrame')
Arguments
outputs
The outputs by name and type.
Returns
Self OperationalizationDefinition
for fluent API
chaining.
redeploy
redeploy(force=False)
Bundle up the definition properties and update the service.
Returns
A new instance of Service
representing the
service deployed.
version
version(version)
Set the service's optional version.
Arguments
version
The version of the service.
Returns
Self OperationalizationDefinition
for fluent API.