Skip to content

[MOD-12831] test_info_modules:test_pending_jobs_metrics_search Extend output on timeout#7609

Merged
meiravgri merged 2 commits intomasterfrom
meiravg_verbose_pending_workers_jobs
Dec 2, 2025
Merged

[MOD-12831] test_info_modules:test_pending_jobs_metrics_search Extend output on timeout#7609
meiravgri merged 2 commits intomasterfrom
meiravg_verbose_pending_workers_jobs

Conversation

@meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Dec 2, 2025

A flaky failure of this test was encounterd in cluster env on macos intel.
The test was introduced in #7556

This PR extends the output log in case of timeout.
Also, the previous mechnism to check if the query errored was wrong.
I moved the queries distribtion to a general callback in common.py that also detects better failures.


Note

Adds a threading helper to run repeated commands with exception monitoring and updates pending-jobs metrics tests to use it and include worker stats for better timeout diagnostics.

  • Tests (pending jobs metrics):
    • Replace ad-hoc threading with launch_cmds_in_bg_with_exception_check to run FT.SEARCH/FT.AGGREGATE in background and detect early failures.
    • Enrich wait_for_condition state with WORKERS stats in checks for indexing pending jobs, query pending jobs, and metrics reset.
    • On helper-detected failure, WORKERS RESUME and exit early to avoid deadlock.
  • Common utilities:
    • Add launch_cmds_in_bg_with_exception_check(env, command, num_triggers, exception_timeout) to spawn threads, monitor exceptions, and assert on failures.

Written by Cursor Bugbot for commit 8f8fb49. This will update automatically on new commits. Configure here.

add workers stats to state if will fail
@github-actions github-actions bot added the size:S label Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.74%. Comparing base (ea0476a) to head (8f8fb49).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7609      +/-   ##
==========================================
- Coverage   84.76%   84.74%   -0.03%     
==========================================
  Files         351      351              
  Lines       54178    54204      +26     
  Branches    14553    14567      +14     
==========================================
+ Hits        45925    45934       +9     
- Misses       8062     8079      +17     
  Partials      191      191              
Flag Coverage Δ
flow 85.06% <ø> (-0.02%) ⬇️
unit 52.07% <ø> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@meiravgri meiravgri requested a review from JoanFM December 2, 2025 14:20
t.start()

# Check for exceptions before proceeding
if exception_event.wait(timeout=1):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be error prone. What if exceptions simply work.

I would simply return the threads.

@meiravgri meiravgri requested a review from JoanFM December 2, 2025 16:25
if exception_event.wait(timeout=exception_timeout):
error_msg = f"Background command {command} failed with {len(exceptions)} error(s): {exceptions}"
env.assertTrue(False, message=error_msg)
return None

This comment was marked as outdated.

@meiravgri meiravgri enabled auto-merge December 2, 2025 17:11
@meiravgri meiravgri added this pull request to the merge queue Dec 2, 2025
Merged via the queue into master with commit 7db7c2e Dec 2, 2025
26 checks passed
@meiravgri meiravgri deleted the meiravg_verbose_pending_workers_jobs branch December 2, 2025 19:48
@meiravgri
Copy link
Collaborator Author

/backport

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-7609-to-2.8 origin/2.8
cd .worktree/backport-7609-to-2.8
git switch --create backport-7609-to-2.8
git cherry-pick -x 7db7c2e810384b67f8c9e97c9d707ab47bacdce0

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.10, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.10
git worktree add -d .worktree/backport-7609-to-2.10 origin/2.10
cd .worktree/backport-7609-to-2.10
git switch --create backport-7609-to-2.10
git cherry-pick -x 7db7c2e810384b67f8c9e97c9d707ab47bacdce0

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 8.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.2
git worktree add -d .worktree/backport-7609-to-8.2 origin/8.2
cd .worktree/backport-7609-to-8.2
git switch --create backport-7609-to-8.2
git cherry-pick -x 7db7c2e810384b67f8c9e97c9d707ab47bacdce0

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 8.4, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 8.4
git worktree add -d .worktree/backport-7609-to-8.4 origin/8.4
cd .worktree/backport-7609-to-8.4
git switch --create backport-7609-to-8.4
git cherry-pick -x 7db7c2e810384b67f8c9e97c9d707ab47bacdce0

meiravgri added a commit that referenced this pull request Dec 3, 2025
…nd output on timeout (#7609)

* move queries to run_cmds_in_bg
add workers stats to state if will fail

* refcator run_cmds_in_bg

(cherry picked from commit 7db7c2e)
meiravgri added a commit that referenced this pull request Dec 3, 2025
…nd output on timeout (#7609)

* move queries to run_cmds_in_bg
add workers stats to state if will fail

* refcator run_cmds_in_bg

(cherry picked from commit 7db7c2e)
github-merge-queue bot pushed a commit that referenced this pull request Dec 3, 2025
* [MOD-12069] Add `*_pending_jobs` metrics (#7556)

* align info/* to active_coord

* add APIs to get queues length

* add to info

* fix

* test

* fix test

* catch general error

* rename

* fix moduleArgs

* rename

* rename test_active_worker_threads

* rename to wworketrs

(cherry picked from commit ea0476a)

* [MOD-12831] `test_info_modules:test_pending_jobs_metrics_search` Extend output on timeout (#7609)

* move queries to run_cmds_in_bg
add workers stats to state if will fail

* refcator run_cmds_in_bg

(cherry picked from commit 7db7c2e)
meiravgri added a commit that referenced this pull request Dec 9, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
meiravgri added a commit that referenced this pull request Dec 10, 2025
…nd output on timeout (#7609)

* move queries to run_cmds_in_bg
add workers stats to state if will fail

* refcator run_cmds_in_bg

(cherry picked from commit 7db7c2e)
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2025
* [MOD-12069] Add `*_pending_jobs` metrics (#7556)

* align info/* to active_coord

* add APIs to get queues length

* add to info

* fix

* test

* fix test

* catch general error

* rename

* fix moduleArgs

* rename

* rename test_active_worker_threads

* rename to wworketrs

(cherry picked from commit ea0476a)

* [MOD-12831] `test_info_modules:test_pending_jobs_metrics_search` Extend output on timeout (#7609)

* move queries to run_cmds_in_bg
add workers stats to state if will fail

* refcator run_cmds_in_bg

(cherry picked from commit 7db7c2e)

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants