-
Notifications
You must be signed in to change notification settings - Fork 8
fix: time based state refresh for each activity #796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses an issue where stale connection data was persisting across successive workflow runs in crossover 2.0. The fix ensures that state is properly cleaned before each activity execution.
Key Changes:
- Modified state management in
_get_stateto unconditionally clean state before setting new state
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📜 Docstring Coverage ReportRESULT: PASSED (minimum: 30.0%, actual: 75.4%) Detailed Coverage Report |
📦 Trivy Vulnerability Scan Results
Report Summary
Scan Result Details✅ No vulnerabilities found during the scan for |
📦 Trivy Secret Scan Results
Report Summary
Scan Result Details✅ No secrets found during the scan for |
|
🛠 Docs available at: https://k.atlan.dev/application-sdk/activity-state-fix |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
|
🛠 Full Test Coverage Report: https://k.atlan.dev/coverage/application-sdk/pr/796 |
Bug: State Management Typo Causes Caching FailuresThe state management logic has two issues. A typo ( |
Bug: Timestamp Update Missing in Base ClassMissing timestamp update in base class |
Bug: Timestamp Handling Fails for Initial StatesThe timestamp refresh logic can fail if |
| if last_updated and current_timestamp - last_updated > timedelta( | ||
| minutes=15 | ||
| ): | ||
| await self._set_state(workflow_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Bug
The ActivitiesInterface._set_state method doesn't set the last_updated_timestamp field. This prevents the 15-minute state refresh logic in _get_state from ever triggering for activities using the base class, leading to inconsistent refresh behavior across different activity implementations.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhishekagrawal-atlan please take a loo
| if workflow_id not in self._state: | ||
| await self._set_state(workflow_args) | ||
|
|
||
| if workflow_id in self._state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put this under an else block
|
@abhishekagrawal-atlan - has this been tested on production instances? is this ready to merge? |
📦 Example workflows test results
|
📦 Example workflows test results
|
📦 Example workflows test results
|
This has been tested on internal instances - https://apps-framework-redshift-testing.atlan.com/. will create a ring of some production instances to test it out. |
Changelog
Checklist
Copyleft License Compliance
Note
Refresh activity state if older than 15 minutes by tracking and updating last_updated_timestamp; initialize timestamp in SQL metadata extraction state.
ActivitiesInterface._get_state: ifcurrent_timestamp - last_updated_timestamp > 15m, reinitialize state via_set_state.ActivitiesStatewithlast_updated_timestamp.BaseSQLMetadataExtractionActivitiesStatewithlast_updated_timestamp.last_updated_timestampin_set_stateafter initializingsql_clientandhandler.Written by Cursor Bugbot for commit 54470ba. This will update automatically on new commits. Configure here.