CodeConfiguration Class

Code configuration for a scoring job.

Inheritance
azure.ai.ml.entities._mixins.DictMixin
CodeConfiguration

Constructor

CodeConfiguration(code: str | PathLike | None = None, scoring_script: str | PathLike | None = None)

Parameters

Name Description
code
Optional[Union[<xref:azure.ai.ml.entities.Code>, str]]

The code directory containing the scoring script. The code can be an Code object, an ARM resource ID of an existing code asset, a local path, or "http:", "https:", or "azureml:" url pointing to a remote location.

default value: None
scoring_script

The scoring script file path relative to the code directory.

default value: None

Examples

Creating a CodeConfiguration for a BatchDeployment.


   from azure.ai.ml.entities import BatchDeployment, CodeConfiguration

   deployment = BatchDeployment(
       name="non-mlflow-deployment",
       description="this is a sample non-mlflow deployment",
       endpoint_name="my-batch-endpoint",
       model=model,
       code_configuration=CodeConfiguration(
           code="configs/deployments/model-2/onlinescoring", scoring_script="score1.py"
       ),
       environment="env",
       compute="cpu-cluster",
       instance_count=2,
       max_concurrency_per_instance=2,
       mini_batch_size=10,
       output_file_name="predictions.csv",
   )

Methods

get
has_key
items
keys
update
values

get

get(key: Any, default: Any | None = None) -> Any

Parameters

Name Description
key
Required
default
default value: None

has_key

has_key(k: Any) -> bool

Parameters

Name Description
k
Required

items

items() -> list

keys

keys() -> list

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> list

Attributes

scoring_script

The scoring script file path relative to the code directory.

Returns

Type Description
str