From 150a081c7130ba879fb06617ce4cdc17ac581afd Mon Sep 17 00:00:00 2001 From: nick863 <30440255+nick863@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:00:15 -0700 Subject: [PATCH] Fixes --- .../promptflow-evals-e2e-test-local.yml | 1 - .../promptflow/evals/evaluate/_eval_run.py | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/promptflow-evals-e2e-test-local.yml b/.github/workflows/promptflow-evals-e2e-test-local.yml index 30fb666d64e..4adaf86c5a9 100644 --- a/.github/workflows/promptflow-evals-e2e-test-local.yml +++ b/.github/workflows/promptflow-evals-e2e-test-local.yml @@ -60,7 +60,6 @@ jobs: id: run_e2e_tests_local run: | poetry run pytest -m localtest tests/evals/e2etests --cov=promptflow --cov-config=pyproject.toml --cov-report=term --cov-report=html --cov-report=xml - poetry run pytest -m e2etest --cov=promptflow --cov-config=pyproject.toml --cov-report=term --cov-report=html --cov-report=xml poetry run python ../../scripts/code_qa/report_to_app_insights.py --activity e2e_tests_local --junit-xml test-results.xml --git-hub-action-run-id ${{ github.run_id }} --git-hub-workflow ${{ github.workflow }} --git-hub-action ${{ github.action }} --git-branch ${{ github.ref }} working-directory: ${{ env.WORKING_DIRECTORY }} - name: upload coverage report diff --git a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py index 57aed2a5441..6c689c7a016 100644 --- a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py +++ b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py @@ -22,6 +22,7 @@ # Handle optional import. The azure libraries are only present if # promptflow-azure is installed. +_AZURE_IMPORTED = True try: from azure.ai.ml.entities._credentials import AccountKeyConfiguration from azure.ai.ml.entities._datastore.datastore import Datastore @@ -30,12 +31,11 @@ # If the above mentioned modules cannot be imported, we are running # in local mode and MLClient in the constructor will be None, so # we will not arrive to Azure-dependent code. - LOGGER.warning( - "azure-ai-ml cannot be imported. " - "The results will be saved locally, but will not be logged to Azure. " - "To log results to azure please install promptflow-evals with the command " - "pip install promptflow-evals[azure]" - ) + + # We are not logging the import failure because + # - If the project configuration was not provided this import is not needed. + # - If the project configuration was provided, the error will be raised by PFClient. + pass @dataclasses.dataclass @@ -133,8 +133,11 @@ def __init__(self, self._is_promptflow_run: bool = promptflow_run is not None self._is_broken = False if self._tracking_uri is None: - LOGGER.warning("tracking_uri was not provided, " - "The results will be saved locally, but will not be logged to Azure.") + if self._tracking_uri: + LOGGER.warning( + "tracking_uri was not provided, " + "The results will be saved locally, but will not be logged to Azure." + ) self._url_base = None self._is_broken = True self.info = RunInfo.generate(run_name)