Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check credential before call spark.read.mltable() #3688

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

check credential before call spark.read.mltable()

ec0e8a1
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

check credential before call spark.read.mltable() #3688

check credential before call spark.read.mltable()
ec0e8a1
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Results for model-monitoring-ci failed Dec 17, 2024 in 0s

3 fail, 11 skipped, 112 pass in 2m 15s

126 tests   112 ✅  2m 15s ⏱️
  2 suites   11 💤
  2 files      3 ❌

Results for commit ec0e8a1.

Annotations

Check warning on line 0 in tests.unit.test_mdc_preprocessor.TestMDCPreprocessor

See this annotation in the file changed.

@github-actions github-actions / Test Results for model-monitoring-ci

test_uri_folder_to_spark_df_no_data[2023-11-03T15:00:00-2023-11-03T16:00:00] (tests.unit.test_mdc_preprocessor.TestMDCPreprocessor) failed

results/group_3_junit3.xml [took 12s]
Raw output
shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.
self = <test_mdc_preprocessor.TestMDCPreprocessor object at 0x7fe33938d2b0>
mdc_preprocessor_test_setup = None, window_start_time = '2023-11-03T15:00:00'
window_end_time = '2023-11-03T16:00:00'

    @pytest.mark.parametrize(
        "window_start_time, window_end_time",
        [
            ("2023-11-03T15:00:00", "2023-11-03T16:00:00"),  # no window folder
            ("2023-11-06T15:00:00", "2023-11-06T16:00:00"),  # has window folder, no file
            ("2023-11-06T17:00:00", "2023-11-06T18:00:00"),  # has window folder and file, but empty file
        ]
    )
    def test_uri_folder_to_spark_df_no_data(self, mdc_preprocessor_test_setup,
                                            window_start_time, window_end_time):
        """Test uri_folder_to_spark_df()."""
        def my_add_tags(tags: dict):
            print("my_add_tags:", tags)
        print("testing test_uri_folder_to_spark_df...")
        print("working dir:", os.getcwd())
    
        fs = fsspec.filesystem("file")
        tests_path = os.path.abspath(f"{os.path.dirname(__file__)}/../../tests")
        preprocessed_output = f"{tests_path}/unit/preprocessed_mdc_data"
        shutil.rmtree(f"{preprocessed_output}temp", True)
        root_folder = f"{tests_path}/unit/raw_mdc_data/"
    
        with pytest.raises(DataNotFoundError):
>           df = _raw_mdc_uri_folder_to_preprocessed_spark_df(
                window_start_time,
                window_end_time,
                root_folder,
                preprocessed_output,
                False,
                fs,
                my_add_tags
            )

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/tests/unit/test_mdc_preprocessor.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:278: in _raw_mdc_uri_folder_to_preprocessed_spark_df
    df = _convert_mltable_to_spark_df(table, preprocessed_input_data, fs, add_tags_func)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:156: in _convert_mltable_to_spark_df
    return try_read_mltable_in_spark_with_error(des_path, "preprocessed_data")
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:68: in try_read_mltable_in_spark_with_error
    return try_read_mltable_in_spark(mltable_path, input_name, NoDataApproach.ERROR)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:126: in try_read_mltable_in_spark
    raise error
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:111: in try_read_mltable_in_spark
    df = read_mltable_in_spark(mltable_path)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:150: in read_mltable_in_spark
    store_url.get_credential(True)  # will raise exception if not able to access
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:112: in get_credential
    return valid_aml_obo_credential()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def valid_aml_obo_credential():
        """Validate AzureMLOnBehalfOfCredential can be used in the environment before returns it."""
        if not self._is_secure():
>           raise InvalidInputError(
                "Unsecure credential-less data is not supported. "
                "Please use either a secure or a credential url for the StoreUrl.")
E           shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:93: InvalidInputError

Check warning on line 0 in tests.unit.test_mdc_preprocessor.TestMDCPreprocessor

See this annotation in the file changed.

@github-actions github-actions / Test Results for model-monitoring-ci

test_uri_folder_to_spark_df_no_data[2023-11-06T17:00:00-2023-11-06T18:00:00] (tests.unit.test_mdc_preprocessor.TestMDCPreprocessor) failed

results/group_3_junit3.xml [took 12s]
Raw output
shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.
self = <test_mdc_preprocessor.TestMDCPreprocessor object at 0x7f90f4bd7550>
mdc_preprocessor_test_setup = None, window_start_time = '2023-11-06T17:00:00'
window_end_time = '2023-11-06T18:00:00'

    @pytest.mark.parametrize(
        "window_start_time, window_end_time",
        [
            ("2023-11-03T15:00:00", "2023-11-03T16:00:00"),  # no window folder
            ("2023-11-06T15:00:00", "2023-11-06T16:00:00"),  # has window folder, no file
            ("2023-11-06T17:00:00", "2023-11-06T18:00:00"),  # has window folder and file, but empty file
        ]
    )
    def test_uri_folder_to_spark_df_no_data(self, mdc_preprocessor_test_setup,
                                            window_start_time, window_end_time):
        """Test uri_folder_to_spark_df()."""
        def my_add_tags(tags: dict):
            print("my_add_tags:", tags)
        print("testing test_uri_folder_to_spark_df...")
        print("working dir:", os.getcwd())
    
        fs = fsspec.filesystem("file")
        tests_path = os.path.abspath(f"{os.path.dirname(__file__)}/../../tests")
        preprocessed_output = f"{tests_path}/unit/preprocessed_mdc_data"
        shutil.rmtree(f"{preprocessed_output}temp", True)
        root_folder = f"{tests_path}/unit/raw_mdc_data/"
    
        with pytest.raises(DataNotFoundError):
>           df = _raw_mdc_uri_folder_to_preprocessed_spark_df(
                window_start_time,
                window_end_time,
                root_folder,
                preprocessed_output,
                False,
                fs,
                my_add_tags
            )

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/tests/unit/test_mdc_preprocessor.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:278: in _raw_mdc_uri_folder_to_preprocessed_spark_df
    df = _convert_mltable_to_spark_df(table, preprocessed_input_data, fs, add_tags_func)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:156: in _convert_mltable_to_spark_df
    return try_read_mltable_in_spark_with_error(des_path, "preprocessed_data")
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:68: in try_read_mltable_in_spark_with_error
    return try_read_mltable_in_spark(mltable_path, input_name, NoDataApproach.ERROR)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:126: in try_read_mltable_in_spark
    raise error
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:111: in try_read_mltable_in_spark
    df = read_mltable_in_spark(mltable_path)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:150: in read_mltable_in_spark
    store_url.get_credential(True)  # will raise exception if not able to access
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:112: in get_credential
    return valid_aml_obo_credential()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def valid_aml_obo_credential():
        """Validate AzureMLOnBehalfOfCredential can be used in the environment before returns it."""
        if not self._is_secure():
>           raise InvalidInputError(
                "Unsecure credential-less data is not supported. "
                "Please use either a secure or a credential url for the StoreUrl.")
E           shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:93: InvalidInputError

Check warning on line 0 in tests.unit.test_mdc_preprocessor.TestMDCPreprocessor

See this annotation in the file changed.

@github-actions github-actions / Test Results for model-monitoring-ci

test_uri_folder_to_spark_df_no_data[2023-11-06T15:00:00-2023-11-06T16:00:00] (tests.unit.test_mdc_preprocessor.TestMDCPreprocessor) failed

results/group_3_junit3.xml [took 8s]
Raw output
shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.
self = <test_mdc_preprocessor.TestMDCPreprocessor object at 0x7fe33938d190>
mdc_preprocessor_test_setup = None, window_start_time = '2023-11-06T15:00:00'
window_end_time = '2023-11-06T16:00:00'

    @pytest.mark.parametrize(
        "window_start_time, window_end_time",
        [
            ("2023-11-03T15:00:00", "2023-11-03T16:00:00"),  # no window folder
            ("2023-11-06T15:00:00", "2023-11-06T16:00:00"),  # has window folder, no file
            ("2023-11-06T17:00:00", "2023-11-06T18:00:00"),  # has window folder and file, but empty file
        ]
    )
    def test_uri_folder_to_spark_df_no_data(self, mdc_preprocessor_test_setup,
                                            window_start_time, window_end_time):
        """Test uri_folder_to_spark_df()."""
        def my_add_tags(tags: dict):
            print("my_add_tags:", tags)
        print("testing test_uri_folder_to_spark_df...")
        print("working dir:", os.getcwd())
    
        fs = fsspec.filesystem("file")
        tests_path = os.path.abspath(f"{os.path.dirname(__file__)}/../../tests")
        preprocessed_output = f"{tests_path}/unit/preprocessed_mdc_data"
        shutil.rmtree(f"{preprocessed_output}temp", True)
        root_folder = f"{tests_path}/unit/raw_mdc_data/"
    
        with pytest.raises(DataNotFoundError):
>           df = _raw_mdc_uri_folder_to_preprocessed_spark_df(
                window_start_time,
                window_end_time,
                root_folder,
                preprocessed_output,
                False,
                fs,
                my_add_tags
            )

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/tests/unit/test_mdc_preprocessor.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:278: in _raw_mdc_uri_folder_to_preprocessed_spark_df
    df = _convert_mltable_to_spark_df(table, preprocessed_input_data, fs, add_tags_func)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/model_data_collector_preprocessor/run.py:156: in _convert_mltable_to_spark_df
    return try_read_mltable_in_spark_with_error(des_path, "preprocessed_data")
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:68: in try_read_mltable_in_spark_with_error
    return try_read_mltable_in_spark(mltable_path, input_name, NoDataApproach.ERROR)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:126: in try_read_mltable_in_spark
    raise error
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:111: in try_read_mltable_in_spark
    df = read_mltable_in_spark(mltable_path)
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/io_utils.py:150: in read_mltable_in_spark
    store_url.get_credential(True)  # will raise exception if not able to access
/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:112: in get_credential
    return valid_aml_obo_credential()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def valid_aml_obo_credential():
        """Validate AzureMLOnBehalfOfCredential can be used in the environment before returns it."""
        if not self._is_secure():
>           raise InvalidInputError(
                "Unsecure credential-less data is not supported. "
                "Please use either a secure or a credential url for the StoreUrl.")
E           shared_utilities.momo_exceptions.InvalidInputError: Unsecure credential-less data is not supported. Please use either a secure or a credential url for the StoreUrl.

/home/runner/work/azureml-assets/azureml-assets/assets/model_monitoring/components/src/shared_utilities/store_url.py:93: InvalidInputError