Skip to content
GitHub Actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++) failed May 7, 2024 in 0s

5 fail, 13 skipped, 658 pass in 57m 10s

    4 files  ± 0      4 suites  ±0   57m 10s ⏱️ - 2m 35s
  676 tests + 5    658 ✅ + 3  13 💤 ±0   5 ❌ +2 
2 704 runs  +20  2 636 ✅ +16  52 💤 ±0  16 ❌ +4 

Results for commit ff5dbd9. ± Comparison against earlier commit f78c9fd.

Annotations

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++)

All 4 runs failed: test_override_signature_for_param_without_annotation[AzureOpenAIModelConfiguration] (tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 0s]
Raw output
promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': AzureOpenAIModelConfiguration(azure_deployment='my_deployment', azure_endpoint='fake_endpoint', api_version=None, api_key=None, connection=None), 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.
self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec68f890>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
>                   resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:428: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:353: in _resolve_init_kwargs
    self._resolve_model_config_params(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'promptflow.executor._script_executor.ScriptExecutor'>
model_config_param_name_2_cls = {'azure_open_ai_model_config': <class 'promptflow.core._model_configuration.AzureOpenAIModelConfiguration'>, 'open_ai_model_config': <class 'promptflow.core._model_configuration.OpenAIModelConfiguration'>}
init_kwargs = {'dynamic_param': AzureOpenAIModelConfiguration(azure_deployment='my_deployment', azure_endpoint='fake_endpoint', api_...IModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}
resolved_init_kwargs = {'dynamic_param': AzureOpenAIModelConfiguration(azure_deployment='my_deployment', azure_endpoint='fake_endpoint', api_...IModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}

    @classmethod
    def _resolve_model_config_params(
        cls, model_config_param_name_2_cls: dict, init_kwargs: dict, resolved_init_kwargs: dict
    ):
        # parse model config
        logger.debug(f"Resolving model config params: {model_config_param_name_2_cls}")
        for key, model_config_cls in model_config_param_name_2_cls.items():
>           model_config_val = init_kwargs[key]
E           KeyError: 'azure_open_ai_model_config'

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:375: KeyError

The above exception was the direct cause of the following exception:

self = <sdk_cli_test.e2etests.test_flow_test.TestFlowTest object at 0x7efdd6de1710>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7efdec4732d0>
param_type = 'AzureOpenAIModelConfiguration'
param_value = AzureOpenAIModelConfiguration(azure_deployment='my_deployment', azure_endpoint='fake_endpoint', api_version=None, api_key=None, connection=None)

    @pytest.mark.parametrize(
        "param_type, param_value",
        [
            pytest.param(
                "AzureOpenAIModelConfiguration",
                AzureOpenAIModelConfiguration(
                    azure_deployment="my_deployment",
                    azure_endpoint="fake_endpoint",
                ),
                id="AzureOpenAIModelConfiguration",
            ),
            pytest.param(
                "OpenAIModelConfiguration",
                OpenAIModelConfiguration(model="my_model", base_url="fake_base_url"),
                id="OpenAIModelConfiguration",
            ),
            pytest.param(
                "AzureOpenAIConnection",
                "azure_open_ai_connection",
                id="AzureOpenAIConnection",
            ),
        ],
    )
    def test_override_signature_for_param_without_annotation(self, pf, param_type: str, param_value):
        flow_path = Path(f"{EAGER_FLOWS_DIR}/flow_with_signature_model_configuration")
        config2 = OpenAIModelConfiguration(model="my_model", connection="open_ai_connection")
        with open(flow_path / "flow.flex.yaml", "r") as f:
            yaml_dict = yaml.safe_load(f)
    
        with tempfile.TemporaryDirectory() as temp_dir:
            shutil.copytree(flow_path, Path(temp_dir) / "flow_with_signature_model_configuration")
            flow_path = Path(temp_dir) / "flow_with_signature_model_configuration"
            with open(flow_path / "flow.flex.yaml", "w") as f:
                yaml_dict["init"]["dynamic_param"]["type"] = param_type
                yaml.dump(yaml_dict, f)
>           pf.test(
                flow=flow_path,
                inputs={"func_input": "input"},
                init={"dynamic_param": param_value, "open_ai_model_config": config2},
            )

/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_flow_test.py:576: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_pf_client.py:472: in test
    return self.flows.test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:135: in test
    result = self._test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:284: in _test
    with TestSubmitter(flow=flow, flow_context=flow.context, client=self._client).init(
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/contextlib.py:137: in __enter__
    return next(self.gen)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_orchestrator/test_submitter.py:293: in init
    self._executor_proxy = ProxyFactory().create_executor_proxy(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_proxy_factory.py:69: in create_executor_proxy
    return async_run_allowing_running_loop(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/_utils/async_utils.py:39: in async_run_allowing_running_loop
    return asyncio.run(async_func(*args, **kwargs))
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:190: in run
    return runner.run(main)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_python_executor_proxy.py:67: in create
    flow_executor = FlowExecutor.create(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/flow_executor.py:222: in create
    return ScriptExecutor(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:73: in __init__
    self._initialize_function()
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:451: in _initialize_function
    func = self._parse_entry_func()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec68f890>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
                    resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)
                    obj = func(**resolved_init_kwargs)
                except Exception as e:
                    # TODO: scrub secrets in init kwarg values
>                   raise FlowEntryInitializationError(init_kwargs=self._init_kwargs, ex=e) from e
E                   promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': AzureOpenAIModelConfiguration(azure_deployment='my_deployment', azure_endpoint='fake_endpoint', api_version=None, api_key=None, connection=None), 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:432: FlowEntryInitializationError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++)

All 4 runs failed: test_override_signature_for_param_without_annotation[OpenAIModelConfiguration] (tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 0s]
Raw output
promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': OpenAIModelConfiguration(model='my_model', base_url='fake_base_url', api_key=None, organization=None, connection=None), 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.
self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec0c6a10>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
>                   resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:428: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:353: in _resolve_init_kwargs
    self._resolve_model_config_params(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'promptflow.executor._script_executor.ScriptExecutor'>
model_config_param_name_2_cls = {'azure_open_ai_model_config': <class 'promptflow.core._model_configuration.AzureOpenAIModelConfiguration'>, 'open_ai_model_config': <class 'promptflow.core._model_configuration.OpenAIModelConfiguration'>}
init_kwargs = {'dynamic_param': OpenAIModelConfiguration(model='my_model', base_url='fake_base_url', api_key=None, organization=None...IModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}
resolved_init_kwargs = {'dynamic_param': OpenAIModelConfiguration(model='my_model', base_url='fake_base_url', api_key=None, organization=None...IModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}

    @classmethod
    def _resolve_model_config_params(
        cls, model_config_param_name_2_cls: dict, init_kwargs: dict, resolved_init_kwargs: dict
    ):
        # parse model config
        logger.debug(f"Resolving model config params: {model_config_param_name_2_cls}")
        for key, model_config_cls in model_config_param_name_2_cls.items():
>           model_config_val = init_kwargs[key]
E           KeyError: 'azure_open_ai_model_config'

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:375: KeyError

The above exception was the direct cause of the following exception:

self = <sdk_cli_test.e2etests.test_flow_test.TestFlowTest object at 0x7efdd6de1990>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7efdec4732d0>
param_type = 'OpenAIModelConfiguration'
param_value = OpenAIModelConfiguration(model='my_model', base_url='fake_base_url', api_key=None, organization=None, connection=None)

    @pytest.mark.parametrize(
        "param_type, param_value",
        [
            pytest.param(
                "AzureOpenAIModelConfiguration",
                AzureOpenAIModelConfiguration(
                    azure_deployment="my_deployment",
                    azure_endpoint="fake_endpoint",
                ),
                id="AzureOpenAIModelConfiguration",
            ),
            pytest.param(
                "OpenAIModelConfiguration",
                OpenAIModelConfiguration(model="my_model", base_url="fake_base_url"),
                id="OpenAIModelConfiguration",
            ),
            pytest.param(
                "AzureOpenAIConnection",
                "azure_open_ai_connection",
                id="AzureOpenAIConnection",
            ),
        ],
    )
    def test_override_signature_for_param_without_annotation(self, pf, param_type: str, param_value):
        flow_path = Path(f"{EAGER_FLOWS_DIR}/flow_with_signature_model_configuration")
        config2 = OpenAIModelConfiguration(model="my_model", connection="open_ai_connection")
        with open(flow_path / "flow.flex.yaml", "r") as f:
            yaml_dict = yaml.safe_load(f)
    
        with tempfile.TemporaryDirectory() as temp_dir:
            shutil.copytree(flow_path, Path(temp_dir) / "flow_with_signature_model_configuration")
            flow_path = Path(temp_dir) / "flow_with_signature_model_configuration"
            with open(flow_path / "flow.flex.yaml", "w") as f:
                yaml_dict["init"]["dynamic_param"]["type"] = param_type
                yaml.dump(yaml_dict, f)
>           pf.test(
                flow=flow_path,
                inputs={"func_input": "input"},
                init={"dynamic_param": param_value, "open_ai_model_config": config2},
            )

/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_flow_test.py:576: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_pf_client.py:472: in test
    return self.flows.test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:135: in test
    result = self._test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:284: in _test
    with TestSubmitter(flow=flow, flow_context=flow.context, client=self._client).init(
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/contextlib.py:137: in __enter__
    return next(self.gen)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_orchestrator/test_submitter.py:293: in init
    self._executor_proxy = ProxyFactory().create_executor_proxy(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_proxy_factory.py:69: in create_executor_proxy
    return async_run_allowing_running_loop(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/_utils/async_utils.py:39: in async_run_allowing_running_loop
    return asyncio.run(async_func(*args, **kwargs))
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:190: in run
    return runner.run(main)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_python_executor_proxy.py:67: in create
    flow_executor = FlowExecutor.create(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/flow_executor.py:222: in create
    return ScriptExecutor(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:73: in __init__
    self._initialize_function()
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:451: in _initialize_function
    func = self._parse_entry_func()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec0c6a10>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
                    resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)
                    obj = func(**resolved_init_kwargs)
                except Exception as e:
                    # TODO: scrub secrets in init kwarg values
>                   raise FlowEntryInitializationError(init_kwargs=self._init_kwargs, ex=e) from e
E                   promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': OpenAIModelConfiguration(model='my_model', base_url='fake_base_url', api_key=None, organization=None, connection=None), 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:432: FlowEntryInitializationError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++)

All 4 runs failed: test_override_signature_for_param_without_annotation[AzureOpenAIConnection] (tests.sdk_cli_test.e2etests.test_flow_test.TestFlowTest)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 0s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 0s]
Raw output
promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': 'azure_open_ai_connection', 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.
self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec687e50>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
>                   resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:428: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:353: in _resolve_init_kwargs
    self._resolve_model_config_params(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'promptflow.executor._script_executor.ScriptExecutor'>
model_config_param_name_2_cls = {'azure_open_ai_model_config': <class 'promptflow.core._model_configuration.AzureOpenAIModelConfiguration'>, 'open_ai_model_config': <class 'promptflow.core._model_configuration.OpenAIModelConfiguration'>}
init_kwargs = {'dynamic_param': 'azure_open_ai_connection', 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}
resolved_init_kwargs = {'dynamic_param': 'azure_open_ai_connection', 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}

    @classmethod
    def _resolve_model_config_params(
        cls, model_config_param_name_2_cls: dict, init_kwargs: dict, resolved_init_kwargs: dict
    ):
        # parse model config
        logger.debug(f"Resolving model config params: {model_config_param_name_2_cls}")
        for key, model_config_cls in model_config_param_name_2_cls.items():
>           model_config_val = init_kwargs[key]
E           KeyError: 'azure_open_ai_model_config'

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:375: KeyError

The above exception was the direct cause of the following exception:

self = <sdk_cli_test.e2etests.test_flow_test.TestFlowTest object at 0x7efdd6de1c10>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7efdec4732d0>
param_type = 'AzureOpenAIConnection', param_value = 'azure_open_ai_connection'

    @pytest.mark.parametrize(
        "param_type, param_value",
        [
            pytest.param(
                "AzureOpenAIModelConfiguration",
                AzureOpenAIModelConfiguration(
                    azure_deployment="my_deployment",
                    azure_endpoint="fake_endpoint",
                ),
                id="AzureOpenAIModelConfiguration",
            ),
            pytest.param(
                "OpenAIModelConfiguration",
                OpenAIModelConfiguration(model="my_model", base_url="fake_base_url"),
                id="OpenAIModelConfiguration",
            ),
            pytest.param(
                "AzureOpenAIConnection",
                "azure_open_ai_connection",
                id="AzureOpenAIConnection",
            ),
        ],
    )
    def test_override_signature_for_param_without_annotation(self, pf, param_type: str, param_value):
        flow_path = Path(f"{EAGER_FLOWS_DIR}/flow_with_signature_model_configuration")
        config2 = OpenAIModelConfiguration(model="my_model", connection="open_ai_connection")
        with open(flow_path / "flow.flex.yaml", "r") as f:
            yaml_dict = yaml.safe_load(f)
    
        with tempfile.TemporaryDirectory() as temp_dir:
            shutil.copytree(flow_path, Path(temp_dir) / "flow_with_signature_model_configuration")
            flow_path = Path(temp_dir) / "flow_with_signature_model_configuration"
            with open(flow_path / "flow.flex.yaml", "w") as f:
                yaml_dict["init"]["dynamic_param"]["type"] = param_type
                yaml.dump(yaml_dict, f)
>           pf.test(
                flow=flow_path,
                inputs={"func_input": "input"},
                init={"dynamic_param": param_value, "open_ai_model_config": config2},
            )

/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_flow_test.py:576: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_pf_client.py:472: in test
    return self.flows.test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:135: in test
    result = self._test(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_flow_operations.py:284: in _test
    with TestSubmitter(flow=flow, flow_context=flow.context, client=self._client).init(
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/contextlib.py:137: in __enter__
    return next(self.gen)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_orchestrator/test_submitter.py:293: in init
    self._executor_proxy = ProxyFactory().create_executor_proxy(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_proxy_factory.py:69: in create_executor_proxy
    return async_run_allowing_running_loop(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/_utils/async_utils.py:39: in async_run_allowing_running_loop
    return asyncio.run(async_func(*args, **kwargs))
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:190: in run
    return runner.run(main)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_proxy/_python_executor_proxy.py:67: in create
    flow_executor = FlowExecutor.create(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/flow_executor.py:222: in create
    return ScriptExecutor(
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:73: in __init__
    self._initialize_function()
/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:451: in _initialize_function
    func = self._parse_entry_func()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <promptflow.executor._script_executor.ScriptExecutor object at 0x7efdec687e50>

    def _parse_entry_func(self):
        if self.is_function_entry:
            if inspect.isfunction(self._entry):
                return self._entry
            self._initialize_aggr_function(self._entry)
            return self._entry.__call__
        module_name, func_name = self._parse_flow_file()
        try:
            module = importlib.import_module(module_name)
        except Exception as e:
            error_type_and_message = f"({e.__class__.__name__}) {e}"
            raise PythonLoadError(
                message_format="Failed to load python module for {entry_file}: {error_type_and_message}",
                entry_file=self._flow_file,
                error_type_and_message=error_type_and_message,
            ) from e
        func = getattr(module, func_name, None)
        # check if func is a callable class
        if inspect.isclass(func):
            if hasattr(func, "__call__"):
                logger.debug(
                    f"Python class entry '{func_name}' has __call__ method, initializing it with {self._init_kwargs}"
                )
                try:
                    resolved_init_kwargs = self._resolve_init_kwargs(func, self._init_kwargs)
                    obj = func(**resolved_init_kwargs)
                except Exception as e:
                    # TODO: scrub secrets in init kwarg values
>                   raise FlowEntryInitializationError(init_kwargs=self._init_kwargs, ex=e) from e
E                   promptflow.executor._errors.FlowEntryInitializationError: Failed to initialize flow entry with '{'dynamic_param': 'azure_open_ai_connection', 'open_ai_model_config': OpenAIModelConfiguration(model='my_model', base_url=None, api_key=None, organization=None, connection='open_ai_connection')}', ex:''azure_open_ai_model_config'.

/home/runner/work/promptflow/promptflow/src/promptflow-core/promptflow/executor/_script_executor.py:432: FlowEntryInitializationError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++)

3 out of 4 runs failed: test_delete_traces_three_tables (tests.sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations)

artifacts/Test Results (Python 3.10) (OS ubuntu-latest)/test-results.xml [took 1s]
artifacts/Test Results (Python 3.8) (OS ubuntu-latest)/test-results.xml [took 1s]
artifacts/Test Results (Python 3.9) (OS ubuntu-latest)/test-results.xml [took 1s]
Raw output
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
[SQL: DELETE FROM events WHERE events.trace_id IN (?)]
[parameters: ('938a9961-21ac-4906-ba0b-cf9405d57b9e',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
self = <sqlalchemy.engine.base.Connection object at 0x7f51f0d5eb20>
dialect = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f51f25a5130>
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7f51f0d5eeb0>
statement = <sqlalchemy.dialects.sqlite.base.SQLiteCompiler object at 0x7f51f0d5e190>
parameters = [('938a9961-21ac-4906-ba0b-cf9405d57b9e',)]

    def _exec_single_context(
        self,
        dialect: Dialect,
        context: ExecutionContext,
        statement: Union[str, Compiled],
        parameters: Optional[_AnyMultiExecuteParams],
    ) -> CursorResult[Any]:
        """continue the _execute_context() method for a single DBAPI
        cursor.execute() or cursor.executemany() call.
    
        """
        if dialect.bind_typing is BindTyping.SETINPUTSIZES:
            generic_setinputsizes = context._prepare_set_input_sizes()
    
            if generic_setinputsizes:
                try:
                    dialect.do_set_input_sizes(
                        context.cursor, generic_setinputsizes, context
                    )
                except BaseException as e:
                    self._handle_dbapi_exception(
                        e, str(statement), parameters, None, context
                    )
    
        cursor, str_statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        effective_parameters: Optional[_AnyExecuteParams]
    
        if not context.executemany:
            effective_parameters = parameters[0]
        else:
            effective_parameters = parameters
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                str_statement, effective_parameters = fn(
                    self,
                    cursor,
                    str_statement,
                    effective_parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self._log_info(str_statement)
    
            stats = context._get_cache_stats()
    
            if not self.engine.hide_parameters:
                self._log_info(
                    "[%s] %r",
                    stats,
                    sql_util._repr_params(
                        effective_parameters,
                        batches=10,
                        ismulti=context.executemany,
                    ),
                )
            else:
                self._log_info(
                    "[%s] [SQL parameters hidden due to hide_parameters=True]",
                    stats,
                )
    
        evt_handled: bool = False
        try:
            if context.execute_style is ExecuteStyle.EXECUTEMANY:
                effective_parameters = cast(
                    "_CoreMultiExecuteParams", effective_parameters
                )
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(
                            cursor,
                            str_statement,
                            effective_parameters,
                            context,
                        ):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor,
                        str_statement,
                        effective_parameters,
                        context,
                    )
            elif not effective_parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, str_statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, str_statement, context
                    )
            else:
                effective_parameters = cast(
                    "_CoreSingleExecuteParams", effective_parameters
                )
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(
                            cursor,
                            str_statement,
                            effective_parameters,
                            context,
                        ):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, str_statement, effective_parameters, context
                    )

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1967: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f51f25a5130>
cursor = <sqlite3.Cursor object at 0x7f51e0d76c00>
statement = 'DELETE FROM events WHERE events.trace_id IN (?)'
parameters = ('938a9961-21ac-4906-ba0b-cf9405d57b9e',)
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7f51f0d5eeb0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlite3.OperationalError: database is locked

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/default.py:924: OperationalError

The above exception was the direct cause of the following exception:

self = <sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations object at 0x7f520355c040>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7f520094da60>

    def test_delete_traces_three_tables(self, pf: PFClient) -> None:
        # trace operation does not expose API for events and spans
        # so directly use ORM class to list and assert events and spans existence and deletion
        from promptflow._sdk._orm.trace import Event as ORMEvent
        from promptflow._sdk._orm.trace import LineRun as ORMLineRun
        from promptflow._sdk._orm.trace import Span as ORMSpan
    
        mock_run = str(uuid.uuid4())
        mock_span = mock_span_for_delete_tests(run=mock_run)
        # assert events, span and line_run are persisted
        assert len(ORMEvent.list(trace_id=mock_span.trace_id, span_id=mock_span.span_id)) == 2
        assert len(ORMSpan.list(trace_ids=[mock_span.trace_id])) == 1
        assert len(ORMLineRun.list(runs=[mock_run])) == 1
        # delete traces and assert all traces are deleted
>       pf.traces.delete(run=mock_run)

/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_trace.py:319: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_trace_operations.py:175: in delete
    return self._delete_within_transaction(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_orm/retry.py:50: in f_retry
    return f(*args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_trace_operations.py:240: in _delete_within_transaction
    event_cnt = session.query(ORMEvent).filter(ORMEvent.trace_id.in_(trace_ids)).delete()
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/orm/query.py:3161: in delete
    result: CursorResult[Any] = self.session.execute(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/orm/session.py:2351: in execute
    return self._execute_internal(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/orm/session.py:2236: in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/orm/bulk_persistence.py:1953: in orm_execute_statement
    return super().orm_execute_statement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/orm/context.py:293: in orm_execute_statement
    result = conn.execute(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1418: in execute
    return meth(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/sql/elements.py:515: in _execute_on_connection
    return connection._execute_clauseelement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1640: in _execute_clauseelement
    ret = self._execute_context(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1846: in _execute_context
    return self._exec_single_context(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1986: in _exec_single_context
    self._handle_dbapi_exception(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:2353: in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1967: in _exec_single_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7f51f25a5130>
cursor = <sqlite3.Cursor object at 0x7f51e0d76c00>
statement = 'DELETE FROM events WHERE events.trace_id IN (?)'
parameters = ('938a9961-21ac-4906-ba0b-cf9405d57b9e',)
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7f51f0d5eeb0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
E       [SQL: DELETE FROM events WHERE events.trace_id IN (?)]
E       [parameters: ('938a9961-21ac-4906-ba0b-cf9405d57b9e',)]
E       (Background on this error at: https://sqlalche.me/e/20/e3q8)

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.9/lib/python3.9/site-packages/sqlalchemy/engine/default.py:924: OperationalError

Check warning on line 0 in tests.sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations

See this annotation in the file changed.

@github-actions github-actions / SDK CLI Test Result [zhangxingzhi/allow-override-signature-for-param-without-annotation](https://github.com/microsoft/promptflow/actions/workflows/promptflow-sdk-cli-test.yml?query=branch:zhangxingzhi/allow-override-signature-for-param-without-annotation++)

1 out of 4 runs failed: test_delete_traces_with_collection_and_started_before (tests.sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations)

artifacts/Test Results (Python 3.11) (OS ubuntu-latest)/test-results.xml [took 1s]
Raw output
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
[SQL: DELETE FROM events WHERE events.trace_id IN (?)]
[parameters: ('0419b6e9-c2f9-48a4-a7c5-0256d6e8c5a2',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
self = <sqlalchemy.engine.base.Connection object at 0x7efdeb341a50>
dialect = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7efdebe367d0>
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7efdeb341dd0>
statement = <sqlalchemy.dialects.sqlite.base.SQLiteCompiler object at 0x7efdeb34e790>
parameters = [('0419b6e9-c2f9-48a4-a7c5-0256d6e8c5a2',)]

    def _exec_single_context(
        self,
        dialect: Dialect,
        context: ExecutionContext,
        statement: Union[str, Compiled],
        parameters: Optional[_AnyMultiExecuteParams],
    ) -> CursorResult[Any]:
        """continue the _execute_context() method for a single DBAPI
        cursor.execute() or cursor.executemany() call.
    
        """
        if dialect.bind_typing is BindTyping.SETINPUTSIZES:
            generic_setinputsizes = context._prepare_set_input_sizes()
    
            if generic_setinputsizes:
                try:
                    dialect.do_set_input_sizes(
                        context.cursor, generic_setinputsizes, context
                    )
                except BaseException as e:
                    self._handle_dbapi_exception(
                        e, str(statement), parameters, None, context
                    )
    
        cursor, str_statement, parameters = (
            context.cursor,
            context.statement,
            context.parameters,
        )
    
        effective_parameters: Optional[_AnyExecuteParams]
    
        if not context.executemany:
            effective_parameters = parameters[0]
        else:
            effective_parameters = parameters
    
        if self._has_events or self.engine._has_events:
            for fn in self.dispatch.before_cursor_execute:
                str_statement, effective_parameters = fn(
                    self,
                    cursor,
                    str_statement,
                    effective_parameters,
                    context,
                    context.executemany,
                )
    
        if self._echo:
            self._log_info(str_statement)
    
            stats = context._get_cache_stats()
    
            if not self.engine.hide_parameters:
                self._log_info(
                    "[%s] %r",
                    stats,
                    sql_util._repr_params(
                        effective_parameters,
                        batches=10,
                        ismulti=context.executemany,
                    ),
                )
            else:
                self._log_info(
                    "[%s] [SQL parameters hidden due to hide_parameters=True]",
                    stats,
                )
    
        evt_handled: bool = False
        try:
            if context.execute_style is ExecuteStyle.EXECUTEMANY:
                effective_parameters = cast(
                    "_CoreMultiExecuteParams", effective_parameters
                )
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_executemany:
                        if fn(
                            cursor,
                            str_statement,
                            effective_parameters,
                            context,
                        ):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_executemany(
                        cursor,
                        str_statement,
                        effective_parameters,
                        context,
                    )
            elif not effective_parameters and context.no_parameters:
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute_no_params:
                        if fn(cursor, str_statement, context):
                            evt_handled = True
                            break
                if not evt_handled:
                    self.dialect.do_execute_no_params(
                        cursor, str_statement, context
                    )
            else:
                effective_parameters = cast(
                    "_CoreSingleExecuteParams", effective_parameters
                )
                if self.dialect._has_events:
                    for fn in self.dialect.dispatch.do_execute:
                        if fn(
                            cursor,
                            str_statement,
                            effective_parameters,
                            context,
                        ):
                            evt_handled = True
                            break
                if not evt_handled:
>                   self.dialect.do_execute(
                        cursor, str_statement, effective_parameters, context
                    )

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7efdebe367d0>
cursor = <sqlite3.Cursor object at 0x7efdccce5ac0>
statement = 'DELETE FROM events WHERE events.trace_id IN (?)'
parameters = ('0419b6e9-c2f9-48a4-a7c5-0256d6e8c5a2',)
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7efdeb341dd0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlite3.OperationalError: database is locked

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py:924: OperationalError

The above exception was the direct cause of the following exception:

self = <sdk_cli_test.e2etests.test_trace.TestTraceEntitiesAndOperations object at 0x7efdd6b63110>
pf = <promptflow._sdk._pf_client.PFClient object at 0x7efdec4732d0>

    def test_delete_traces_with_collection_and_started_before(self, pf: PFClient) -> None:
        # mock some traces that start 2 days before, and delete those start 1 days before
        mock_start_time = datetime.datetime.now() - datetime.timedelta(days=2)
        collection1, collection2 = str(uuid.uuid4()), str(uuid.uuid4())
        mock_span_for_delete_tests(collection=collection1, start_time=mock_start_time)
        mock_span_for_delete_tests(collection=collection2, start_time=mock_start_time)
        assert (
            len(pf.traces.list_line_runs(collection=collection1)) == 1
            and len(pf.traces.list_line_runs(collection=collection2)) == 1
        )
        delete_query_time = datetime.datetime.now() - datetime.timedelta(days=1)
>       pf.traces.delete(collection=collection1, started_before=delete_query_time.isoformat())

/home/runner/work/promptflow/promptflow/src/promptflow-devkit/tests/sdk_cli_test/e2etests/test_trace.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_telemetry/activity.py:265: in wrapper
    return f(self, *args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_trace_operations.py:175: in delete
    return self._delete_within_transaction(
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/_orm/retry.py:50: in f_retry
    return f(*args, **kwargs)
/home/runner/work/promptflow/promptflow/src/promptflow-devkit/promptflow/_sdk/operations/_trace_operations.py:240: in _delete_within_transaction
    event_cnt = session.query(ORMEvent).filter(ORMEvent.trace_id.in_(trace_ids)).delete()
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/query.py:3161: in delete
    result: CursorResult[Any] = self.session.execute(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py:2351: in execute
    return self._execute_internal(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py:2236: in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/bulk_persistence.py:1953: in orm_execute_statement
    return super().orm_execute_statement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/context.py:293: in orm_execute_statement
    result = conn.execute(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1418: in execute
    return meth(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:515: in _execute_on_connection
    return connection._execute_clauseelement(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1640: in _execute_clauseelement
    ret = self._execute_context(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1846: in _execute_context
    return self._exec_single_context(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1986: in _exec_single_context
    self._handle_dbapi_exception(
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2353: in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967: in _exec_single_context
    self.dialect.do_execute(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 0x7efdebe367d0>
cursor = <sqlite3.Cursor object at 0x7efdccce5ac0>
statement = 'DELETE FROM events WHERE events.trace_id IN (?)'
parameters = ('0419b6e9-c2f9-48a4-a7c5-0256d6e8c5a2',)
context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 0x7efdeb341dd0>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
E       [SQL: DELETE FROM events WHERE events.trace_id IN (?)]
E       [parameters: ('0419b6e9-c2f9-48a4-a7c5-0256d6e8c5a2',)]
E       (Background on this error at: https://sqlalche.me/e/20/e3q8)

/home/runner/.cache/pypoetry/virtualenvs/promptflow-devkit-bFW165Ac-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py:924: OperationalError