fix(activities): use background thread for async heartbeater#1295
Closed
mothership-ai[bot] wants to merge 1 commit intomainfrom
Closed
fix(activities): use background thread for async heartbeater#1295mothership-ai[bot] wants to merge 1 commit intomainfrom
mothership-ai[bot] wants to merge 1 commit intomainfrom
Conversation
…ve blocking calls The async path in @auto_heartbeater used asyncio.create_task() which gets starved when the event loop is blocked by synchronous calls. Switch to a background thread (same approach as the sync path) so heartbeats continue even during blocking I/O or CPU work inside async activities. Resolves: DBBI-310
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
📜 Docstring Coverage ReportRESULT: PASSED (minimum: 30.0%, actual: 80.2%) Detailed Coverage Report |
Contributor
📦 Trivy Vulnerability Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtVulnerabilities
uv.lockVulnerabilities
|
Contributor
📦 Trivy Secret Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtuv.lock |
Collaborator
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Contributor
|
🛠 Full Test Coverage Report: https://k.atlan.dev/coverage/application-sdk/pr/1295 |
Member
|
Closing — bot-generated PR superseded by #1443 (resilient thread-based heartbeater). Branch preserved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Session owner: @tejeshreddy (tejesh.allampati@atlan.com)
Summary
@auto_heartbeaterusesasyncio.create_task()for async activities, which gets starved when the activity blocks the event loop with synchronous calls (e.g.,requests.get(),time.sleep(), CPU-heavy work), causing heartbeat timeouts.threading.Threadrunningsend_periodic_heartbeat_sync(same approach already used for sync activities). The thread is independent of the event loop and keeps sending heartbeats regardless of blocking.finallyblock sets the stop event, so the heartbeat thread stops immediately on both success and failure — heartbeats do NOT continue after an activity error.What changed
application_sdk/activities/common/utils.pyasyncio.create_task()withthreading.Threadin the async wrappertests/unit/activities/common/test_utils.pyNew tests
test_async_heartbeater_fires_during_blocking_sync_call— verifies heartbeats fire when async activity blocks event loop withtime.sleep()test_async_heartbeater_stops_on_activity_failure— verifies heartbeats stop after async activity raisestest_sync_heartbeater_fires_during_blocking_call— verifies sync path still works correctlytest_sync_heartbeater_stops_on_activity_failure— verifies sync heartbeats stop after failureTest plan
pytest tests/unit/activities/common/test_utils.py)Resolves: DBBI-310