Skip to content

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

Closed
mn-ram wants to merge 2 commits into
augurlabs:mainfrom
mn-ram:fix/facade-dependency-race-condition
Closed

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

Conversation

@mn-ram

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

Copy link
Copy Markdown
Contributor

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
mn-ram added 2 commits March 26, 2026 11:27
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 #3767

Signed-off-by: mn-ram <mn-ram@users.noreply.github.com>
Adds two unit tests for facade_phase() to guard against the race
condition fixed in the previous commit (issue #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
Contributor

#3796 may help reduce the race condition

@mn-ram

mn-ram commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@MoralCode Thanks for the heads up!

@mn-ram mn-ram closed this by deleting the head repository Apr 22, 2026
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