Skip to content

[facade] fix: run dependency tasks after repo clone, not in parallel#3794

Open
mn-ram wants to merge 2 commits intoaugurlabs:mainfrom
mn-ram:fix/facade-dependency-race-condition
Open

[facade] fix: run dependency tasks after repo clone, not in parallel#3794
mn-ram wants to merge 2 commits intoaugurlabs:mainfrom
mn-ram:fix/facade-dependency-race-condition

Conversation

@mn-ram
Copy link
Copy Markdown

@mn-ram mn-ram commented Mar 26, 2026

Description

  • Moved process_dependency_metrics, process_libyear_dependency_metrics, and process_scc_value_metrics out of Celery group() and into the main facade_core_collection chain so they execute strictly after the git clone/update completes.
  • Removed the now-unused group import from celery.

This PR fixes #3767 (also resolves #3459 — same root cause)

Notes for Reviewers

group() dispatches all members simultaneously, so dependency tasks were racing against the git clone and hitting FileNotFoundError on directories that didn't exist yet. Using a single chain() guarantees ordering with no extra overhead.

Signed commits

  • Yes, I signed my commits.

@mn-ram mn-ram requested a review from sgoggins as a code owner March 26, 2026 05:55
Dependency metrics tasks (process_dependency_metrics,
process_libyear_dependency_metrics, process_scc_value_metrics) were
placed inside a Celery group() alongside the facade core collection
chain, causing them to fire concurrently with the git clone/update.
This resulted in a FileNotFoundError when the tasks tried to scan
directories that hadn't been written to disk yet.

Fix: append the three tasks to facade_core_collection and use a single
chain() so they execute strictly after the clone completes.

Fixes augurlabs#3767

Signed-off-by: mn-ram <mn-ram@users.noreply.github.com>
@mn-ram mn-ram force-pushed the fix/facade-dependency-race-condition branch from fb9defb to 2d52a2e Compare March 26, 2026 05:57
Adds two unit tests for facade_phase() to guard against the race
condition fixed in the previous commit (issue augurlabs#3767):

1. test_facade_phase_returns_chain - verifies the returned sequence is
   not a Celery group(), which would dispatch tasks in parallel.
2. test_facade_phase_dependency_tasks_follow_clone - verifies that
   process_dependency_metrics, process_libyear_dependency_metrics, and
   process_scc_value_metrics appear strictly after the git clone task
   in the chain, not before or alongside it.

All Augur/DB dependencies are stubbed so no live environment is needed.

Signed-off-by: mn-ram <mn-ram@users.noreply.github.com>
@mn-ram mn-ram requested a review from MoralCode as a code owner March 26, 2026 06:10
@MoralCode
Copy link
Copy Markdown
Collaborator

#3796 may help reduce the race condition

@mn-ram
Copy link
Copy Markdown
Author

mn-ram commented Mar 26, 2026

@MoralCode Thanks for the heads up!

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

Labels

None yet

Projects

None yet

2 participants