code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def delete_endpoint_config(self): """ Handler for the SageMaker "DeleteEndpointConfig" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpointConfig.html. """ config_name = self.request_params["EndpointConfigName"] self.sagemaker_backe...
Handler for the SageMaker "DeleteEndpointConfig" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpointConfig.html.
delete_endpoint_config
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_endpoint(self): """ Handler for the SageMaker "CreateEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html. """ endpoint_name = self.request_params["EndpointName"] endpoint_config_name = self.request_params[...
Handler for the SageMaker "CreateEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html.
create_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def update_endpoint(self): """ Handler for the SageMaker "UpdateEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_UpdateEndpoint.html. """ endpoint_name = self.request_params["EndpointName"] new_config_name = self.request_params["Endp...
Handler for the SageMaker "UpdateEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_UpdateEndpoint.html.
update_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def delete_endpoint(self): """ Handler for the SageMaker "DeleteEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpoint.html. """ endpoint_name = self.request_params["EndpointName"] self.sagemaker_backend.delete_endpoint(endp...
Handler for the SageMaker "DeleteEndpoint" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpoint.html.
delete_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_endpoints(self): """ Handler for the SageMaker "ListEndpoints" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpoints.html. This function does not support pagination. All endpoint configs are returned in a single response. ""...
Handler for the SageMaker "ListEndpoints" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpoints.html. This function does not support pagination. All endpoint configs are returned in a single response.
list_endpoints
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_endpoint_configs(self): """ Handler for the SageMaker "ListEndpointConfigs" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpointConfigs.html. This function does not support pagination. All endpoint configs are returned in a single r...
Handler for the SageMaker "ListEndpointConfigs" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpointConfigs.html. This function does not support pagination. All endpoint configs are returned in a single response.
list_endpoint_configs
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_models(self): """ Handler for the SageMaker "ListModels" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListModels.html. This function does not support pagination. All endpoint configs are returned in a single response. """ ...
Handler for the SageMaker "ListModels" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListModels.html. This function does not support pagination. All endpoint configs are returned in a single response.
list_models
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_model(self): """ Handler for the SageMaker "CreateModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateModel.html. """ model_name = self.request_params["ModelName"] primary_container = self.request_params["PrimaryContainer"...
Handler for the SageMaker "CreateModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateModel.html.
create_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_model(self): """ Handler for the SageMaker "DescribeModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeModel.html. """ model_name = self.request_params["ModelName"] model_description = self.sagemaker_backend.describe_...
Handler for the SageMaker "DescribeModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeModel.html.
describe_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def delete_model(self): """ Handler for the SageMaker "DeleteModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteModel.html. """ model_name = self.request_params["ModelName"] self.sagemaker_backend.delete_model(model_name) re...
Handler for the SageMaker "DeleteModel" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteModel.html.
delete_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_tags(self): """ Handler for the SageMaker "ListTags" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTags.html """ arn = self.request_params["ResourceArn"] sagemaker_resource = ( "models" if "model" in arn e...
Handler for the SageMaker "ListTags" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTags.html
list_tags
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_transform_job(self): """ Handler for the SageMaker "CreateTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTransformJob.html. """ job_name = self.request_params["TransformJobName"] model_name = self.req...
Handler for the SageMaker "CreateTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTransformJob.html.
create_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def stop_transform_job(self): """ Handler for the SageMaker "StopTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StopTransformJob.html. """ job_name = self.request_params["TransformJobName"] self.sagemaker_backend.stop...
Handler for the SageMaker "StopTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StopTransformJob.html.
stop_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_transform_job(self): """ Handler for the SageMaker "DescribeTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTransformJob.html. """ job_name = self.request_params["TransformJobName"] transform_job_d...
Handler for the SageMaker "DescribeTransformJob" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTransformJob.html.
describe_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_transform_jobs(self): """ Handler for the SageMaker "ListTransformJobs" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTransformJobs.html. This function does not support pagination. All transform jobs are returned in a single...
Handler for the SageMaker "ListTransformJobs" API call documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTransformJobs.html. This function does not support pagination. All transform jobs are returned in a single response.
list_transform_jobs
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def _url_module(self): """ Required override from the Moto "BaseBackend" object that reroutes requests from the specified SageMaker URLs to the mocked SageMaker backend. """ urls_module_name = "tests.sagemaker.mock.mock_sagemaker_urls" return __import__(urls_module_name, ...
Required override from the Moto "BaseBackend" object that reroutes requests from the specified SageMaker URLs to the mocked SageMaker backend.
_url_module
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def _get_base_arn(self, region_name): """ Returns: A SageMaker ARN prefix that can be prepended to a resource name. """ return SageMakerBackend.BASE_SAGEMAKER_ARN.format( region_name=region_name, account_id=DEFAULT_ACCOUNT_ID )
Returns: A SageMaker ARN prefix that can be prepended to a resource name.
_get_base_arn
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_endpoint_config( self, config_name, production_variants, tags, region_name, async_inference_config ): """ Modifies backend state during calls to the SageMaker "CreateEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndp...
Modifies backend state during calls to the SageMaker "CreateEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpointConfig.html.
create_endpoint_config
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_endpoint_config(self, config_name): """ Modifies backend state during calls to the SageMaker "DescribeEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeEndpointConfig.html. """ if config_name not in self.endpoint...
Modifies backend state during calls to the SageMaker "DescribeEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeEndpointConfig.html.
describe_endpoint_config
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def delete_endpoint_config(self, config_name): """ Modifies backend state during calls to the SageMaker "DeleteEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpointConfig.html. """ if config_name not in self.endpoint_confi...
Modifies backend state during calls to the SageMaker "DeleteEndpointConfig" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpointConfig.html.
delete_endpoint_config
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_endpoint(self, endpoint_name, endpoint_config_name, tags, region_name): """ Modifies backend state during calls to the SageMaker "CreateEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html. """ if endpoint_name ...
Modifies backend state during calls to the SageMaker "CreateEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html.
create_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_endpoint(self, endpoint_name): """ Modifies backend state during calls to the SageMaker "DescribeEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeEndpoint.html. """ if endpoint_name not in self.endpoints: ...
Modifies backend state during calls to the SageMaker "DescribeEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeEndpoint.html.
describe_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def update_endpoint(self, endpoint_name, new_config_name): """ Modifies backend state during calls to the SageMaker "UpdateEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_UpdateEndpoint.html. """ if endpoint_name not in self.endpoints: ...
Modifies backend state during calls to the SageMaker "UpdateEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_UpdateEndpoint.html.
update_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def delete_endpoint(self, endpoint_name): """ Modifies backend state during calls to the SageMaker "DeleteEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpoint.html. """ if endpoint_name not in self.endpoints: raise ...
Modifies backend state during calls to the SageMaker "DeleteEndpoint" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteEndpoint.html.
delete_endpoint
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_endpoints(self): """ Modifies backend state during calls to the SageMaker "ListEndpoints" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpoints.html. """ summaries = [] for _, endpoint in self.endpoints.items(): ...
Modifies backend state during calls to the SageMaker "ListEndpoints" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpoints.html.
list_endpoints
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_endpoint_configs(self): """ Modifies backend state during calls to the SageMaker "ListEndpointConfigs" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpointConfigs.html. """ summaries = [] for _, endpoint_config in self.end...
Modifies backend state during calls to the SageMaker "ListEndpointConfigs" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListEndpointConfigs.html.
list_endpoint_configs
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_models(self): """ Modifies backend state during calls to the SageMaker "ListModels" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListModels.html. """ summaries = [] for _, model in self.models.items(): summary = Mod...
Modifies backend state during calls to the SageMaker "ListModels" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListModels.html.
list_models
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_tags(self, resource_arn, region_name, resource_type): """ Modifies backend state during calls to the SageMaker "ListTags" API https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTags.html """ resource_values = getattr(self, resource_type).values() f...
Modifies backend state during calls to the SageMaker "ListTags" API https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTags.html
list_tags
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_model( self, model_name, primary_container, execution_role_arn, tags, region_name, vpc_config=None ): """ Modifies backend state during calls to the SageMaker "CreateModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateModel.html. ...
Modifies backend state during calls to the SageMaker "CreateModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateModel.html.
create_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_model(self, model_name): """ Modifies backend state during calls to the SageMaker "DescribeModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeModel.html. """ if model_name not in self.models: raise ValueError( ...
Modifies backend state during calls to the SageMaker "DescribeModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeModel.html.
describe_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def delete_model(self, model_name): """ Modifies backend state during calls to the SageMaker "DeleteModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteModel.html. """ if model_name not in self.models: raise ValueError( ...
Modifies backend state during calls to the SageMaker "DeleteModel" API documented here: https://docs.aws.amazon.com/sagemaker/latest/dg/API_DeleteModel.html.
delete_model
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def create_transform_job( self, job_name, model_name, transform_input, transform_output, transform_resources, data_processing, tags, region_name, ): """ Modifies backend state during calls to the SageMaker "CreateTransformJob" A...
Modifies backend state during calls to the SageMaker "CreateTransformJob" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTransformJob.html.
create_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def describe_transform_job(self, job_name): """ Modifies backend state during calls to the SageMaker "DescribeTransformJob" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTransformJob.html. """ if job_name not in self.transform_...
Modifies backend state during calls to the SageMaker "DescribeTransformJob" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTransformJob.html.
describe_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def stop_transform_job(self, job_name): """ Modifies backend state during calls to the SageMaker "StopTransformJob" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StopTransformJob.html. """ if job_name not in self.transform_jobs: ...
Modifies backend state during calls to the SageMaker "StopTransformJob" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StopTransformJob.html.
stop_transform_job
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def list_transform_jobs(self): """ Modifies backend state during calls to the SageMaker "ListTransformJobs" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTransformJobs.html. """ summaries = [] for _, transform_job in self.t...
Modifies backend state during calls to the SageMaker "ListTransformJobs" API documented here: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTransformJobs.html.
list_transform_jobs
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def __init__(self, endpoint_name, config_name, tags, latest_operation): """ Args: endpoint_name: The name of the Endpoint. config_name: The name of the EndpointConfiguration to associate with the Endpoint. tags: Arbitrary tags to associate with the endpoint. ...
Args: endpoint_name: The name of the Endpoint. config_name: The name of the EndpointConfiguration to associate with the Endpoint. tags: Arbitrary tags to associate with the endpoint. latest_operation: The most recent operation that was invoked on the endpoint, ...
__init__
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def __init__( self, job_name, model_name, transform_input, transform_output, transform_resources, data_processing, tags, latest_operation, ): """ Args: job_name: The name of the TransformJob. model_name: ...
Args: job_name: The name of the TransformJob. model_name: The name of the model to associate with the TransformJob. transform_input: The input data source and the way transform job consumes it. transform_output: The output results of the transform job. ...
__init__
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def __init__(self, latency_seconds, pending_status, completed_status): """ Args: latency_seconds: The latency of the operation, in seconds. Before the time window specified by this latency elapses, the operation will have the status specified by ``pending_stat...
Args: latency_seconds: The latency of the operation, in seconds. Before the time window specified by this latency elapses, the operation will have the status specified by ``pending_status``. After the time window elapses, the operation will have the s...
__init__
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def __init__(self, latency_seconds, pending_status, completed_status): """ Args: latency_seconds: The latency of the operation, in seconds. Before the time window specified by this latency elapses, the operation will have the status specified by ``pending_stat...
Args: latency_seconds: The latency of the operation, in seconds. Before the time window specified by this latency elapses, the operation will have the status specified by ``pending_status``. After the time window elapses, the operation will have the s...
__init__
python
mlflow/mlflow
tests/sagemaker/mock/__init__.py
https://github.com/mlflow/mlflow/blob/master/tests/sagemaker/mock/__init__.py
Apache-2.0
def test_search_runs_default_view_type(mock_get_request_message, mock_tracking_store): """ Search Runs default view type is filled in as ViewType.ACTIVE_ONLY """ mock_get_request_message.return_value = SearchRuns(experiment_ids=["0"]) mock_tracking_store.search_runs.return_value = PagedList([], None...
Search Runs default view type is filled in as ViewType.ACTIVE_ONLY
test_search_runs_default_view_type
python
mlflow/mlflow
tests/server/test_handlers.py
https://github.com/mlflow/mlflow/blob/master/tests/server/test_handlers.py
Apache-2.0
def test_search_experiments(client, monkeypatch): """ Use user1 to create 10 experiments, grant READ permission to user2 on experiments [0, 3, 4, 5, 6, 8]. Test whether user2 can search only and all the readable experiments, both paged and un-paged. """ username1, password1 = create_user(cli...
Use user1 to create 10 experiments, grant READ permission to user2 on experiments [0, 3, 4, 5, 6, 8]. Test whether user2 can search only and all the readable experiments, both paged and un-paged.
test_search_experiments
python
mlflow/mlflow
tests/server/auth/test_auth.py
https://github.com/mlflow/mlflow/blob/master/tests/server/auth/test_auth.py
Apache-2.0
def test_search_registered_models(client, monkeypatch): """ Use user1 to create 10 registered_models, grant READ permission to user2 on registered_models [0, 3, 4, 5, 6, 8]. Test whether user2 can search only and all the readable registered_models, both paged and un-paged. """ username1, pas...
Use user1 to create 10 registered_models, grant READ permission to user2 on registered_models [0, 3, 4, 5, 6, 8]. Test whether user2 can search only and all the readable registered_models, both paged and un-paged.
test_search_registered_models
python
mlflow/mlflow
tests/server/auth/test_auth.py
https://github.com/mlflow/mlflow/blob/master/tests/server/auth/test_auth.py
Apache-2.0
def test_sklearn_log_explainer(): """ Tests mlflow.shap log_explainer with mlflow serialization of the underlying model """ with mlflow.start_run() as run: run_id = run.info.run_id X, y = get_housing_data() model = sklearn.ensemble.RandomForestRegressor(n_estimators=100) ...
Tests mlflow.shap log_explainer with mlflow serialization of the underlying model
test_sklearn_log_explainer
python
mlflow/mlflow
tests/shap/test_log.py
https://github.com/mlflow/mlflow/blob/master/tests/shap/test_log.py
Apache-2.0
def test_sklearn_log_explainer_self_serialization(): """ Tests mlflow.shap log_explainer with SHAP internal serialization of the underlying model """ with mlflow.start_run() as run: run_id = run.info.run_id X, y = get_housing_data() model = sklearn.ensemble.RandomForestRegress...
Tests mlflow.shap log_explainer with SHAP internal serialization of the underlying model
test_sklearn_log_explainer_self_serialization
python
mlflow/mlflow
tests/shap/test_log.py
https://github.com/mlflow/mlflow/blob/master/tests/shap/test_log.py
Apache-2.0
def test_sklearn_log_explainer_pyfunc(): """ Tests mlflow.shap log_explainer with mlflow serialization of the underlying model using pyfunc flavor """ with mlflow.start_run() as run: run_id = run.info.run_id X, y = get_housing_data() model = sklearn.ensemble.RandomForestRe...
Tests mlflow.shap log_explainer with mlflow serialization of the underlying model using pyfunc flavor
test_sklearn_log_explainer_pyfunc
python
mlflow/mlflow
tests/shap/test_log.py
https://github.com/mlflow/mlflow/blob/master/tests/shap/test_log.py
Apache-2.0
def yield_artifacts(run_id, path=None): """ Yields all artifacts in the specified run. """ client = MlflowClient() for item in client.list_artifacts(run_id, path): if item.is_dir: yield from yield_artifacts(run_id, item.path) else: yield item.path
Yields all artifacts in the specified run.
yield_artifacts
python
mlflow/mlflow
tests/shap/test_shap.py
https://github.com/mlflow/mlflow/blob/master/tests/shap/test_shap.py
Apache-2.0
def test_log_explanation_with_small_features(): """ Verifies that `log_explanation` does not fail even when `features` has less records than `_MAXIMUM_BACKGROUND_DATA_SIZE`. """ num_rows = 50 assert num_rows < mlflow.shap._MAXIMUM_BACKGROUND_DATA_SIZE X, y = get_diabetes() X, y = X.iloc...
Verifies that `log_explanation` does not fail even when `features` has less records than `_MAXIMUM_BACKGROUND_DATA_SIZE`.
test_log_explanation_with_small_features
python
mlflow/mlflow
tests/shap/test_shap.py
https://github.com/mlflow/mlflow/blob/master/tests/shap/test_shap.py
Apache-2.0
def _get_model_uri(name: str = MODEL_DIR) -> str: """ Search for the model with the given name and return its URI. """ if uri := next( m.model_uri for m in mlflow.search_logged_models(output_format="list") if m.name == name ): return uri raise ValueError(f"Model with name {name:...
Search for the model with the given name and return its URI.
_get_model_uri
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def test_autolog_emits_warning_message_when_metric_fails(): """ Take precision_score metric from SVC as an example to test metric logging failure """ mlflow.sklearn.autolog() model = sklearn.svm.SVC() @functools.wraps(sklearn.metrics.precision_score) def throwing_metrics(y_true, y_pred): ...
Take precision_score metric from SVC as an example to test metric logging failure
test_autolog_emits_warning_message_when_metric_fails
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def test_autolog_emits_warning_message_when_model_prediction_fails(): """ Take GridSearchCV as an example, whose base class is "classifier" and will go through classifier's metric logging. When refit=False, the model will never get refitted, while during the metric logging what ".predict()" expects is a...
Take GridSearchCV as an example, whose base class is "classifier" and will go through classifier's metric logging. When refit=False, the model will never get refitted, while during the metric logging what ".predict()" expects is a fitted model. Thus, a warning will be logged.
test_autolog_emits_warning_message_when_model_prediction_fails
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def test_autolog_does_not_capture_runs_for_preprocessing_or_feature_manipulation_estimators(): """ Verifies that preprocessing and feature manipulation estimators, which represent data manipulation steps (e.g., normalization, label encoding) rather than ML models, do not produce runs when their fit_* op...
Verifies that preprocessing and feature manipulation estimators, which represent data manipulation steps (e.g., normalization, label encoding) rather than ML models, do not produce runs when their fit_* operations are invoked independently of an ML pipeline
test_autolog_does_not_capture_runs_for_preprocessing_or_feature_manipulation_estimators
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def test_autolog_produces_expected_results_for_estimator_when_parent_also_defines_fit(): """ Test to prevent recurrences of https://github.com/mlflow/mlflow/issues/3574 """ mlflow.sklearn.autolog() # Construct two mock models - `ParentMod` and `ChildMod`, where ChildMod's fit() function # calls...
Test to prevent recurrences of https://github.com/mlflow/mlflow/issues/3574
test_autolog_produces_expected_results_for_estimator_when_parent_also_defines_fit
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def test_metric_computation_handles_absent_labels(): """ Verifies that autologging metric computation does not fail For models that do not require labels as inputs to training, such as clustering models and other unsupervised techniques. """ mlflow.sklearn.autolog() model = sklearn.cluster.KMea...
Verifies that autologging metric computation does not fail For models that do not require labels as inputs to training, such as clustering models and other unsupervised techniques.
test_metric_computation_handles_absent_labels
python
mlflow/mlflow
tests/sklearn/test_sklearn_autolog.py
https://github.com/mlflow/mlflow/blob/master/tests/sklearn/test_sklearn_autolog.py
Apache-2.0
def assert_tag_value_meets_requirements(run_id): """ Verify that the Spark Datasource tag set on the run has been truncated to the maximum tag value length allowed by MLflow """ run = mlflow.get_run(run_id) assert _SPARK_TABLE_INFO_TAG_NAME in run.data.tags table_...
Verify that the Spark Datasource tag set on the run has been truncated to the maximum tag value length allowed by MLflow
assert_tag_value_meets_requirements
python
mlflow/mlflow
tests/spark/autologging/datasource/test_spark_datasource_autologging.py
https://github.com/mlflow/mlflow/blob/master/tests/spark/autologging/datasource/test_spark_datasource_autologging.py
Apache-2.0
def test_download_artifacts_awaits_download_completion(base_uri, download_arg, list_return_val): """ Verifies that all asynchronous artifact downloads are joined before `download_artifacts()` returns a result to the caller """ def list_artifacts(path): fullpath = posixpath.join(base_uri, pa...
Verifies that all asynchronous artifact downloads are joined before `download_artifacts()` returns a result to the caller
test_download_artifacts_awaits_download_completion
python
mlflow/mlflow
tests/store/artifact/test_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_artifact_repo.py
Apache-2.0
def get_mock_listing(*args, **kwargs): """ Produces a mock listing that only contains content if the specified prefix is the artifact root. This allows us to mock `list_artifacts` during the `_download_artifacts_into` subroutine without recursively listing the same artifacts at e...
Produces a mock listing that only contains content if the specified prefix is the artifact root. This allows us to mock `list_artifacts` during the `_download_artifacts_into` subroutine without recursively listing the same artifacts at every level of the directory traversal. ...
get_mock_listing
python
mlflow/mlflow
tests/store/artifact/test_azure_blob_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_azure_blob_artifact_repo.py
Apache-2.0
def get_mock_listing(*args, **kwargs): """ Produces a mock listing that only contains content if the specified prefix is the artifact root or a relevant subdirectory. This allows us to mock `list_artifacts` during the `_download_artifacts_into` subroutine without recursively listing the ...
Produces a mock listing that only contains content if the specified prefix is the artifact root or a relevant subdirectory. This allows us to mock `list_artifacts` during the `_download_artifacts_into` subroutine without recursively listing the same artifacts at every level of the direc...
get_mock_listing
python
mlflow/mlflow
tests/store/artifact/test_azure_blob_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_azure_blob_artifact_repo.py
Apache-2.0
def _run_download_artifact_command(args) -> pathlib.Path: # noqa: D417 """ Args: command: An `mlflow artifacts` command list. Returns: Path to the downloaded artifact. """ runner = CliRunner() resp = runner.invoke(download_artifacts, args=args, catch_exceptions=False) asser...
Args: command: An `mlflow artifacts` command list. Returns: Path to the downloaded artifact.
_run_download_artifact_command
python
mlflow/mlflow
tests/store/artifact/test_cli.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_cli.py
Apache-2.0
def test_get_read_credential_infos_handles_pagination(databricks_artifact_repo): """ Verifies that the `get_read_credential_infos` method, which is used to resolve read access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all pages ha...
Verifies that the `get_read_credential_infos` method, which is used to resolve read access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all pages have been consumed
test_get_read_credential_infos_handles_pagination
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_get_read_credential_infos_respects_max_request_size(databricks_artifact_repo): """ Verifies that the `_get_read_credential_infos` method, which is used to resolve read access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all ...
Verifies that the `_get_read_credential_infos` method, which is used to resolve read access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all pages have been consumed
test_get_read_credential_infos_respects_max_request_size
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_get_write_credential_infos_handles_pagination(databricks_artifact_repo): """ Verifies that the `_get_write_credential_infos` method, which is used to resolve write access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all page...
Verifies that the `_get_write_credential_infos` method, which is used to resolve write access credentials for a collection of artifacts, handles paginated responses properly, issuing incremental requests until all pages have been consumed
test_get_write_credential_infos_handles_pagination
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_get_write_credential_infos_respects_max_request_size(databricks_artifact_repo): """ Verifies that the `_get_write_credential_infos` method, which is used to resolve write access credentials for a collection of artifacts, batches requests according to a maximum request size configured by the bac...
Verifies that the `_get_write_credential_infos` method, which is used to resolve write access credentials for a collection of artifacts, batches requests according to a maximum request size configured by the backend
test_get_write_credential_infos_respects_max_request_size
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_artifact_logging(databricks_artifact_repo, tmp_path): """ Verifies that `log_artifact()` and `log_artifacts()` initiate all expected asynchronous artifact uploads and await their completion before returning results to the caller """ src_dir = tmp_path.joinpath("src") src_dir.mkdir() ...
Verifies that `log_artifact()` and `log_artifacts()` initiate all expected asynchronous artifact uploads and await their completion before returning results to the caller
test_artifact_logging
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_artifact_logging_chunks_upload_list(databricks_artifact_repo, tmp_path): """ Verifies that write credentials are fetched in chunks rather than all at once. """ src_dir = tmp_path.joinpath("src") src_dir.mkdir() for i in range(10): src_dir.joinpath(f"file_{i}.txt").write_text(f"f...
Verifies that write credentials are fetched in chunks rather than all at once.
test_artifact_logging_chunks_upload_list
python
mlflow/mlflow
tests/store/artifact/test_databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_databricks_artifact_repo.py
Apache-2.0
def test_download_artifacts_does_not_copy(local_artifact_repo): """ The LocalArtifactRepository.download_artifact function should not copy the artifact if the ``dst_path`` argument is None. """ artifact_rel_path = "test.txt" artifact_text = "hello world!" with TempDir(chdr=True) as local_dir...
The LocalArtifactRepository.download_artifact function should not copy the artifact if the ``dst_path`` argument is None.
test_download_artifacts_does_not_copy
python
mlflow/mlflow
tests/store/artifact/test_local_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_local_artifact_repo.py
Apache-2.0
def test_models_artifact_repo_uses_repo_download_artifacts(tmp_path): """ `ModelsArtifactRepository` should delegate `download_artifacts` to its `self.repo.download_artifacts` function. """ artifact_location = "s3://blah_bucket/" dummy_file = tmp_path / "dummy_file.txt" dummy_file.touch() ...
`ModelsArtifactRepository` should delegate `download_artifacts` to its `self.repo.download_artifacts` function.
test_models_artifact_repo_uses_repo_download_artifacts
python
mlflow/mlflow
tests/store/artifact/test_models_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_models_artifact_repo.py
Apache-2.0
def test_runs_artifact_repo_uses_repo_download_artifacts(): """ The RunsArtifactRepo should delegate `download_artifacts` to it's self.repo.download_artifacts function """ artifact_location = "s3://blah_bucket/" experiment_id = mlflow.create_experiment("expr_abcd", artifact_location) with ml...
The RunsArtifactRepo should delegate `download_artifacts` to it's self.repo.download_artifacts function
test_runs_artifact_repo_uses_repo_download_artifacts
python
mlflow/mlflow
tests/store/artifact/test_runs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/tests/store/artifact/test_runs_artifact_repo.py
Apache-2.0
def test_mysql_ssl_params(monkeypatch): """Test that MySQL SSL certificate params are correctly passed to create_engine.""" monkeypatch.setenv("MLFLOW_MYSQL_SSL_CA", "/path/to/ca.pem") monkeypatch.setenv("MLFLOW_MYSQL_SSL_CERT", "/path/to/cert.pem") monkeypatch.setenv("MLFLOW_MYSQL_SSL_KEY", "/path/to/k...
Test that MySQL SSL certificate params are correctly passed to create_engine.
test_mysql_ssl_params
python
mlflow/mlflow
tests/store/db/test_utils.py
https://github.com/mlflow/mlflow/blob/master/tests/store/db/test_utils.py
Apache-2.0
def test_mysql_ssl_params_partial(monkeypatch): """Test that MySQL SSL certificate params work with only CA certificate.""" monkeypatch.setenv("MLFLOW_MYSQL_SSL_CA", "/path/to/ca.pem") monkeypatch.delenv("MLFLOW_MYSQL_SSL_CERT", raising=False) monkeypatch.delenv("MLFLOW_MYSQL_SSL_KEY", raising=False) ...
Test that MySQL SSL certificate params work with only CA certificate.
test_mysql_ssl_params_partial
python
mlflow/mlflow
tests/store/db/test_utils.py
https://github.com/mlflow/mlflow/blob/master/tests/store/db/test_utils.py
Apache-2.0
def test_non_mysql_no_ssl_params(monkeypatch): """Test that non-MySQL connections don't get SSL params.""" monkeypatch.setenv("MLFLOW_MYSQL_SSL_CA", "/path/to/ca.pem") monkeypatch.setenv("MLFLOW_MYSQL_SSL_CERT", "/path/to/cert.pem") monkeypatch.setenv("MLFLOW_MYSQL_SSL_KEY", "/path/to/key.pem") monk...
Test that non-MySQL connections don't get SSL params.
test_non_mysql_no_ssl_params
python
mlflow/mlflow
tests/store/db/test_utils.py
https://github.com/mlflow/mlflow/blob/master/tests/store/db/test_utils.py
Apache-2.0
def set_model_version_tag(self, name: str, version: int, tag: ModelVersionTag): """Mock implementation to set model version tags.""" mv = self.get_model_version(name, version) if isinstance(mv.tags, dict): mv.tags[tag.key] = tag.value else: # Convert to dict if it...
Mock implementation to set model version tags.
set_model_version_tag
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def add_prompt_version(self, name: str, version: str): """Helper method to add prompt versions for testing.""" # Convert version to integer for PromptVersion version_int = int(version[1:]) if version.startswith("v") else int(version) # Store using both formats to handle version lookups ...
Helper method to add prompt versions for testing.
add_prompt_version
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_success(store, mock_tracking_store): """Test successful linking of prompt version to model.""" # Setup store.add_prompt_version("test_prompt", "1") model_id = "model_123" # Mock logged model with no existing linked prompts logged_model = LoggedModel( ...
Test successful linking of prompt version to model.
test_link_prompt_version_to_model_success
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_append_to_existing(store, mock_tracking_store): """Test linking prompt version when other prompts are already linked.""" # Setup store.add_prompt_version("test_prompt", "1") model_id = "model_123" existing_prompts = [{"name": "existing_prompt", "version": "v1"}...
Test linking prompt version when other prompts are already linked.
test_link_prompt_version_to_model_append_to_existing
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_no_model_found(store, mock_tracking_store): """Test error when model is not found.""" # Setup store.add_prompt_version("test_prompt", "1") mock_tracking_store.get_logged_model.return_value = None # Execute & Verify with pytest.raises(MlflowException, match=...
Test error when model is not found.
test_link_prompt_version_to_model_no_model_found
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_prompt_not_found(store, mock_tracking_store): """Test error when prompt version is not found.""" # Setup model_id = "model_123" logged_model = LoggedModel( experiment_id="exp_123", model_id=model_id, name="test_model", artifact_locati...
Test error when prompt version is not found.
test_link_prompt_version_to_model_prompt_not_found
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_invalid_json_tag(store, mock_tracking_store): """Test error when existing linked prompts tag has invalid JSON.""" # Setup store.add_prompt_version("test_prompt", "1") model_id = "model_123" logged_model = LoggedModel( experiment_id="exp_123", mo...
Test error when existing linked prompts tag has invalid JSON.
test_link_prompt_version_to_model_invalid_json_tag
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_invalid_format_tag(store, mock_tracking_store): """Test error when existing linked prompts tag has invalid format (not a list).""" # Setup store.add_prompt_version("test_prompt", "1") model_id = "model_123" logged_model = LoggedModel( experiment_id="exp...
Test error when existing linked prompts tag has invalid format (not a list).
test_link_prompt_version_to_model_invalid_format_tag
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_duplicate_prevention(store, mock_tracking_store): """Test that linking the same prompt version twice doesn't create duplicates.""" # Setup store.add_prompt_version("test_prompt", "1") model_id = "model_123" # Create a logged model that will be updated by the mo...
Test that linking the same prompt version twice doesn't create duplicates.
test_link_prompt_version_to_model_duplicate_prevention
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_model_thread_safety(store, mock_tracking_store): """Test thread safety of linking prompt versions to models.""" # Setup store.add_prompt_version("test_prompt_1", "1") store.add_prompt_version("test_prompt_2", "1") model_id = "model_123" # Create a shared logged m...
Test thread safety of linking prompt versions to models.
test_link_prompt_version_to_model_thread_safety
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_success(store, mock_tracking_store): """Test successful linking of prompt versions to a trace.""" # Setup store.add_prompt_version("test_prompt", "1") trace_id = "trace_123" # Mock trace info mock_trace_info = mock.Mock() mock_trace_info.tags = {} mock_tr...
Test successful linking of prompt versions to a trace.
test_link_prompts_to_trace_success
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_append_to_existing(store, mock_tracking_store): """Test linking prompt versions when other prompts are already linked to the trace.""" # Setup store.add_prompt_version("test_prompt", "1") trace_id = "trace_123" existing_prompts = [{"name": "existing_prompt", "version"...
Test linking prompt versions when other prompts are already linked to the trace.
test_link_prompts_to_trace_append_to_existing
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_nonexistent_trace(store, mock_tracking_store): """Test error handling when trace is not found.""" # Setup store.add_prompt_version("test_prompt", "1") mock_tracking_store.get_trace_info.return_value = None # Execute & Verify prompt_version = store.get_prompt_versi...
Test error handling when trace is not found.
test_link_prompts_to_trace_nonexistent_trace
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_multiple_prompts(store, mock_tracking_store): """Test linking multiple prompt versions to a trace at once.""" # Setup store.add_prompt_version("test_prompt_1", "v1") store.add_prompt_version("test_prompt_2", "v2") trace_id = "trace_123" mock_trace_info = mock.Mock...
Test linking multiple prompt versions to a trace at once.
test_link_prompts_to_trace_multiple_prompts
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_thread_safety(store, mock_tracking_store): """Test thread safety of linking prompt versions to traces.""" # Setup store.add_prompt_version("test_prompt_1", "1") store.add_prompt_version("test_prompt_2", "1") trace_id = "trace_123" # Create shared trace info that w...
Test thread safety of linking prompt versions to traces.
test_link_prompts_to_trace_thread_safety
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_no_change_optimization(store, mock_tracking_store): """Test that tag is not updated when no change is needed.""" # Setup store.add_prompt_version("test_prompt", "1") trace_id = "trace_123" existing_prompts = [{"name": "test_prompt", "version": "1"}] mock_trace_inf...
Test that tag is not updated when no change is needed.
test_link_prompts_to_trace_no_change_optimization
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompts_to_trace_unsupported_store(store, mock_tracking_store): """Test error handling when tracking store doesn't support get_trace_info.""" # Setup store.add_prompt_version("test_prompt", "1") # Mock tracking store that doesn't have get_trace_info method del mock_tracking_store.get_t...
Test error handling when tracking store doesn't support get_trace_info.
test_link_prompts_to_trace_unsupported_store
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_run_success(store, mock_tracking_store): """Test successful linking of prompt version to run.""" # Setup store.add_prompt_version("test_prompt", "1") run_id = "run_123" # Mock run with no existing linked prompts run_data = RunData(metrics=[], params=[], tags={}) ...
Test successful linking of prompt version to run.
test_link_prompt_version_to_run_success
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_run_append_to_existing(store, mock_tracking_store): """Test linking prompt version when other prompts are already linked to the run.""" # Setup store.add_prompt_version("test_prompt_1", "1") store.add_prompt_version("test_prompt_2", "1") run_id = "run_123" # Mock...
Test linking prompt version when other prompts are already linked to the run.
test_link_prompt_version_to_run_append_to_existing
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_run_no_run_found(store, mock_tracking_store): """Test error when run is not found.""" # Setup store.add_prompt_version("test_prompt", "1") # Use "1" instead of "v1" run_id = "nonexistent_run" mock_tracking_store.get_run.return_value = None # Execute and verify ...
Test error when run is not found.
test_link_prompt_version_to_run_no_run_found
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_run_duplicate_prevention(store, mock_tracking_store): """Test that duplicate prompt linkings are prevented.""" # Setup store.add_prompt_version("test_prompt", "1") run_id = "run_123" # Mock run with existing prompt already linked existing_prompts = [{"name": "tes...
Test that duplicate prompt linkings are prevented.
test_link_prompt_version_to_run_duplicate_prevention
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_link_prompt_version_to_run_thread_safety(store, mock_tracking_store): """Test thread safety of linking prompt versions to runs.""" # Setup store.add_prompt_version("test_prompt_1", "1") store.add_prompt_version("test_prompt_2", "1") run_id = "run_123" # Create a shared run that will be...
Test thread safety of linking prompt versions to runs.
test_link_prompt_version_to_run_thread_safety
python
mlflow/mlflow
tests/store/model_registry/test_abstract_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/model_registry/test_abstract_store.py
Apache-2.0
def test_get_deleted_run(store): """ Getting metrics/tags/params/run info should be allowed on deleted runs. """ experiments, exp_data, _ = _create_root(store) exp_id = experiments[random_int(0, len(experiments) - 1)] run_id = exp_data[exp_id]["runs"][0] store.delete_run(run_id) assert s...
Getting metrics/tags/params/run info should be allowed on deleted runs.
test_get_deleted_run
python
mlflow/mlflow
tests/store/tracking/test_file_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_file_store.py
Apache-2.0
def test_set_deleted_run(store): """ Setting metrics/tags/params/updating run info should not be allowed on deleted runs. """ experiments, exp_data, _ = _create_root(store) exp_id = experiments[random_int(0, len(experiments) - 1)] run_id = exp_data[exp_id]["runs"][0] store.delete_run(run_id)...
Setting metrics/tags/params/updating run info should not be allowed on deleted runs.
test_set_deleted_run
python
mlflow/mlflow
tests/store/tracking/test_file_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_file_store.py
Apache-2.0
def test_log_inputs_uses_expected_input_and_dataset_ids_for_storage(store): """ This test verifies that the FileStore uses expected IDs as folder names to represent datasets and run inputs. This is very important because the IDs are used to deduplicate inputs and datasets if the same dataset is logged t...
This test verifies that the FileStore uses expected IDs as folder names to represent datasets and run inputs. This is very important because the IDs are used to deduplicate inputs and datasets if the same dataset is logged to multiple runs or the same dataset is logged multiple times as an input to the...
test_log_inputs_uses_expected_input_and_dataset_ids_for_storage
python
mlflow/mlflow
tests/store/tracking/test_file_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_file_store.py
Apache-2.0
def _verify_requests( http_request, host_creds, endpoint, method, json_body, use_v3=False, retry_timeout_seconds=None ): """ Verify HTTP requests in tests. Args: http_request: The mocked HTTP request object host_creds: MlflowHostCreds object endpoint: The endpoint being called (...
Verify HTTP requests in tests. Args: http_request: The mocked HTTP request object host_creds: MlflowHostCreds object endpoint: The endpoint being called (e.g., "traces/123") method: The HTTP method (e.g., "GET", "POST") json_body: The request body as a JSON string ...
_verify_requests
python
mlflow/mlflow
tests/store/tracking/test_rest_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_rest_store.py
Apache-2.0
def test_search_traces(): """Test the search_traces method with default behavior using SearchTracesV3Request.""" creds = MlflowHostCreds("https://hello") store = RestStore(lambda: creds) response = mock.MagicMock() response.status_code = 200 # Format the response response.text = json.dumps(...
Test the search_traces method with default behavior using SearchTracesV3Request.
test_search_traces
python
mlflow/mlflow
tests/store/tracking/test_rest_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_rest_store.py
Apache-2.0
def test_search_unified_traces(): """Test the search_traces method when using SearchUnifiedTraces with sql_warehouse_id.""" creds = MlflowHostCreds("https://hello") store = RestStore(lambda: creds) response = mock.MagicMock() response.status_code = 200 # Format the response (using TraceInfo for...
Test the search_traces method when using SearchUnifiedTraces with sql_warehouse_id.
test_search_unified_traces
python
mlflow/mlflow
tests/store/tracking/test_rest_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_rest_store.py
Apache-2.0
def test_get_artifact_uri_for_trace_compatibility(): """Test that get_artifact_uri_for_trace works with both TraceInfo and TraceInfoV3 objects.""" from mlflow.tracing.utils.artifact_utils import get_artifact_uri_for_trace # Create a TraceInfo (v2) object trace_info_v2 = TraceInfoV2( request_id=...
Test that get_artifact_uri_for_trace works with both TraceInfo and TraceInfoV3 objects.
test_get_artifact_uri_for_trace_compatibility
python
mlflow/mlflow
tests/store/tracking/test_rest_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_rest_store.py
Apache-2.0
def test_get_trace_info_v3_api(): """ Test that get_trace_info with should_query_v3=True correctly extracts the trace_info from the nested structure in the V3 API response. """ # Generate a sample trace in v3 format with mlflow.start_span(name="test_span") as span: span.set_inputs({"inpu...
Test that get_trace_info with should_query_v3=True correctly extracts the trace_info from the nested structure in the V3 API response.
test_get_trace_info_v3_api
python
mlflow/mlflow
tests/store/tracking/test_rest_store.py
https://github.com/mlflow/mlflow/blob/master/tests/store/tracking/test_rest_store.py
Apache-2.0