@pytest.mark.skipif((tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS), reason='AutoML is not supported in the region yet.')
def test_candidate_estimator_rerun_with_optional_args(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)
    candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME)
    candidate = candidates[1]
    candidate_estimator = CandidateEstimator(candidate, sagemaker_session)
    inputs = sagemaker_session.upload_data(path=TEST_DATA, key_prefix=(PREFIX + '/input'))
    endpoint_name = unique_name_from_base('sagemaker-auto-ml-rerun-candidate-test')
    with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES):
        candidate_estimator.fit(inputs, encrypt_inter_container_traffic=True)
        auto_ml.deploy(initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, candidate=candidate, 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.')
def test_candidate_estimator_rerun_with_optional_args(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)
    candidates = auto_ml.list_candidates(job_name=AUTO_ML_JOB_NAME)
    candidate = candidates[1]
    candidate_estimator = CandidateEstimator(candidate, sagemaker_session)
    inputs = sagemaker_session.upload_data(path=TEST_DATA, key_prefix=(PREFIX + '/input'))
    endpoint_name = unique_name_from_base('sagemaker-auto-ml-rerun-candidate-test')
    with timeout(minutes=AUTO_ML_DEFAULT_TIMEMOUT_MINUTES):
        candidate_estimator.fit(inputs, encrypt_inter_container_traffic=True)
        auto_ml.deploy(initial_instance_count=INSTANCE_COUNT, instance_type=cpu_instance_type, candidate=candidate, 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)