Skip to content

Conversation

@luojiyin1987
Copy link

Summary

Fix #8782 - Add support for HAYSTACK_PROGRESS_BARS environment variable to globally control progress bar behavior across all Haystack components.

Problem

Haystack 1.x had a HAYSTACK_PROGRESS_BARS environment variable that allowed users to globally disable progress bars. This functionality was not migrated to Haystack 2.x, and setting standard tqdm environment variables like TQDM_DISABLE doesn't work because components explicitly pass disable=not self.progress_bar to tqdm.

Solution

Created a centralized get_progress_bar_setting() utility function that:

  1. Checks the HAYSTACK_PROGRESS_BARS environment variable first
  2. Falls back to the component's progress_bar parameter if env var is not set
  3. Supports both enable/disable values (0/1, true/false, on/off, etc.)

This allows users to:

  • Disable all progress bars globally: export HAYSTACK_PROGRESS_BARS=0
  • Enable all progress bars globally: export HAYSTACK_PROGRESS_BARS=1
  • Use component defaults when env var is not set

Serialization Fix

The implementation saves the original progress_bar parameter value as _progress_bar_param for serialization, while self.progress_bar contains the env-resolved value for runtime. This prevents the environment variable effect from being "baked into" serialized pipeline configs.

Changes

  • New file: haystack/utils/progress_helper.py - Core utility function
  • Modified: haystack/utils/__init__.py - Export the new function
  • New file: test/utils/test_progress_helper.py - Comprehensive tests
  • Modified: All embedder and evaluator components with progress_bar parameter:
    • OpenAIDocumentEmbedder
    • HuggingFaceAPIDocumentEmbedder
    • AzureOpenAIDocumentEmbedder
    • SentenceTransformersDocumentEmbedder
    • SentenceTransformersTextEmbedder
    • SentenceTransformersSparseDocumentEmbedder
    • SentenceTransformersDocImageEmbedder
    • LLMEvaluator
    • FaithfulnessEvaluator
    • ContextRelevanceEvaluator
    • MarkdownToDocument converter

Test Plan

  • Unit tests for get_progress_bar_setting() with various env values
  • Manual verification: HAYSTACK_PROGRESS_BARS=0 disables progress bars
  • Manual verification: HAYSTACK_PROGRESS_BARS=1 enables progress bars
  • Verified serialization preserves original parameter value (not env-resolved)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally

@luojiyin1987 luojiyin1987 requested a review from a team as a code owner January 15, 2026 09:52
@luojiyin1987 luojiyin1987 requested review from sjrl and removed request for a team January 15, 2026 09:52
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Jan 15, 2026

@luojiyin1987 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added topic:tests type:documentation Improvements on the docs labels Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENV variable to disable progress bar is not working

3 participants