@pytest.mark.skipif((tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS), reason='AutoML is not supported in the region yet.')
@pytest.mark.canary_quick
def test_deploy_best_candidate(sagemaker_session, cpu_instance_type):
    auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session)
    auto_ml = AutoML(role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session)
    best_candidate = auto_ml.best_candidate(job_name=AUTO_ML_JOB_NAME)
    endpoint_name = unique_name_from_base('sagemaker-auto-ml-best-candidate-test')
    with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES):
        auto_ml.deploy(candidate=best_candidate, initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, endpoint_name=endpoint_name)
    endpoint_status = sagemaker_session.sagemaker_client.describe_endpoint(EndpointName=endpoint_name)['EndpointStatus']
    assert (endpoint_status == 'InService')
    sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name)
@pytest.mark.skipif((tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS), reason='AutoML is not supported in the region yet.')
@pytest.mark.canary_quick
def test_deploy_best_candidate(sagemaker_session, cpu_instance_type):
    auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session)
    auto_ml = AutoML(role=ROLE, target_attribute_name=TARGET_ATTRIBUTE_NAME, sagemaker_session=sagemaker_session)
    best_candidate = auto_ml.best_candidate(job_name=AUTO_ML_JOB_NAME)
    endpoint_name = unique_name_from_base('sagemaker-auto-ml-best-candidate-test')
    with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES):
        auto_ml.deploy(candidate=best_candidate, initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, endpoint_name=endpoint_name)
    endpoint_status = sagemaker_session.sagemaker_client.describe_endpoint(EndpointName=endpoint_name)['EndpointStatus']
    assert (endpoint_status == 'InService')
    sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name)