-
Notifications
You must be signed in to change notification settings - Fork 140
[python] Remove Python-3.10-only Ollama auto-pull block in integration tests #831
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,16 +16,13 @@ | |
| # limitations under the License. | ||
| ################################################################################ | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
| from unittest.mock import MagicMock | ||
|
|
||
| import pytest | ||
| from ollama import Client | ||
|
|
||
| from flink_agents.api.resource import Resource, ResourceType | ||
| from flink_agents.api.resource_context import ResourceContext | ||
| from flink_agents.e2e_tests.test_utils import pull_model | ||
| from flink_agents.integrations.embedding_models.local.ollama_embedding_model import ( | ||
| OllamaEmbeddingModelConnection, | ||
| OllamaEmbeddingModelSetup, | ||
|
|
@@ -34,27 +31,8 @@ | |
| pytestmark = pytest.mark.integration | ||
|
|
||
| test_model = os.environ.get("OLLAMA_EMBEDDING_MODEL", "all-minilm:22m") | ||
| current_dir = Path(__file__).parent | ||
|
|
||
| try: | ||
| # only auto setup ollama in ci with python 3.10 to reduce ci cost. | ||
| if "3.10" in sys.version: | ||
| subprocess.run( | ||
| ["bash", f"{current_dir}/start_ollama_server.sh"], timeout=300, check=True | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done here too — same |
||
| client = Client() | ||
| models = client.list() | ||
|
|
||
| model_found = False | ||
| for model in models["models"]: | ||
| if model.model == test_model: | ||
| model_found = True | ||
| break | ||
|
|
||
| if not model_found: | ||
| client = None # type: ignore | ||
| except Exception: | ||
| client = None # type: ignore | ||
| client = pull_model(test_model) | ||
|
|
||
|
|
||
| @pytest.mark.skipif( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script
start_ollama_server.shinstalls the Ollama server and pulls the required models. After moving the integration tests into theit-pythonpipeline, we no longer need to install the Ollama server separately; however, we still need to pull the test models being used. We can use thepull_modelmethod intest_utils.py.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch -
tools/start_ollama_server.shonly installs the server; it doesn't pull models, so after dropping the inline block these tests would skip on a missing model in CI rather than actually run.Switched both files to
client = pull_model(test_model)frome2e_tests/test_utils.py— the same helper the e2e integration tests already use. It pulls the model and returns the client (orNone), so the existingskipif(client is None)guard is unchanged. Also dropped the now-unusedfrom ollama import Client.Verified locally: the embedding test now runs instead of skipping. Fixed in 3b8d9e1.