You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "weiqingy (via GitHub)" <gi...@apache.org> on 2026/06/10 06:53:28 UTC

[PR] [python] Remove Python-3.10-only Ollama auto-pull block in integration tests [flink-agents]

weiqingy opened a new pull request, #831:
URL: https://github.com/apache/flink-agents/pull/831

   Linked issue: #701
   
   ### Purpose of change
   
   Follow-up cleanup to #161. That PR moved the Ollama integration tests into the `it-python` CI job, which installs Ollama at the step level via `tools/start_ollama_server.sh` (ci.yml:192/229/275). That made the inline `if "3.10" in sys.version: subprocess.run(...)` auto-pull block at the top of the two Ollama test files dead code in every CI cell:
   
   - `ut-python` excludes these tests via `-m "not integration"`, so the module-import side effect never fires there.
   - `it-python` runs Python 3.11 and 3.12 only, so the `if "3.10" in sys.version` guard is always false.
   
   This PR:
   
   - Removes the dead auto-pull block from both Ollama test files, along with the now-unused `subprocess`, `sys`, and `Path` imports and the `current_dir` variable (each was used only inside the removed block).
   - Keeps the `client = Client()` + `@pytest.mark.skipif(client is None, ...)` guard, so the tests still skip cleanly on developer machines without Ollama running.
   - Deletes the two orphaned `start_ollama_server.sh` copies under the test directories (`integrations/chat_models/tests/` and `integrations/embedding_models/local/tests/`). After removing the inline block, nothing referenced them; CI uses the canonical `tools/start_ollama_server.sh`.
   
   Audit of issue item 4: `grep -rln "subprocess.run" python/flink_agents/integrations/` returns only these two files — no other integration test carries the same anti-pattern.
   
   One open question for maintainers (issue item 3): does any local-dev workflow rely on the inline auto-pull — i.e. is anyone running these tests directly on a Python 3.10 venv without first starting Ollama? If so, the new prerequisite (start Ollama first, e.g. `bash tools/start_ollama_server.sh`) is worth a line in CONTRIBUTING.md. The `skipif` guard already turns a missing Ollama into a clean skip rather than a failure, so this PR does not add a doc note; happy to follow up if preferred.
   
   ### Tests
   
   No new tests — this removes dead code. Verified locally:
   
   - `ruff check` and `ruff format --check` pass on both files.
   - `pytest -m integration` on both files: chat tests pass (Ollama running locally), embedding test skips cleanly — confirming the removed imports/symbols leave no broken references and the `skipif` guard still works.
   
   ### API
   
   No. Test-only change, no public API touched.
   
   ### Documentation
   
   - [x] `doc-not-needed`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [python] Remove Python-3.10-only Ollama auto-pull block in integration tests [flink-agents]

Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 merged PR #831:
URL: https://github.com/apache/flink-agents/pull/831


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [python] Remove Python-3.10-only Ollama auto-pull block in integration tests [flink-agents]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on code in PR #831:
URL: https://github.com/apache/flink-agents/pull/831#discussion_r3393174813


##########
python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py:
##########
@@ -37,16 +34,8 @@
 pytestmark = pytest.mark.integration
 
 test_model = os.environ.get("OLLAMA_CHAT_MODEL", "qwen3:1.7b")
-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", test_model],
-            timeout=300,
-            check=True,
-        )

Review Comment:
   Good catch -`tools/start_ollama_server.sh` only 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)` from `e2e_tests/test_utils.py` — the same helper the e2e integration tests already use. It pulls the model and returns the client (or `None`), so the existing `skipif(client is None)` guard is unchanged. Also dropped the now-unused `from ollama import Client`.
   
   Verified locally: the embedding test now runs instead of skipping. Fixed in 3b8d9e1.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [python] Remove Python-3.10-only Ollama auto-pull block in integration tests [flink-agents]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on code in PR #831:
URL: https://github.com/apache/flink-agents/pull/831#discussion_r3393175665


##########
python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py:
##########
@@ -34,14 +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
-        )

Review Comment:
   Done here too — same `pull_model(test_model)` switch as the chat test. 3b8d9e1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [python] Remove Python-3.10-only Ollama auto-pull block in integration tests [flink-agents]

Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 commented on code in PR #831:
URL: https://github.com/apache/flink-agents/pull/831#discussion_r3386766768


##########
python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py:
##########
@@ -34,14 +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
-        )

Review Comment:
   ditto



##########
python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py:
##########
@@ -37,16 +34,8 @@
 pytestmark = pytest.mark.integration
 
 test_model = os.environ.get("OLLAMA_CHAT_MODEL", "qwen3:1.7b")
-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", test_model],
-            timeout=300,
-            check=True,
-        )

Review Comment:
   The script `start_ollama_server.sh` installs the Ollama server and pulls the required models. After moving the integration tests into the `it-python` pipeline, we no longer need to install the Ollama server separately; however, we still need to pull the test models being used. We can use the `pull_model` method in `test_utils.py`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org