Skip to content

D-43840 Support abort signal in container python plugin - #23

Open
tgreblicki-notch wants to merge 1 commit into
mainfrom
D-43840
Open

tgreblicki-notch wants to merge 1 commit into
mainfrom
D-43840

Conversation

@tgreblicki-notch

@tgreblicki-notch tgreblicki-notch commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Adds support for abort signal in python sdk.
It also add worker thread for task execution to enable abort of blocking task executions.

https://www7.v1host.com/V1Production/defect.mvc/Summary?oidToken=Defect%3A3648730

support SIGABRT for aborting tasks, update unit tests and docs
@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Upwind Upwind Code Scan - ⚠️ Warn

5 newly introduced vulnerabilities · 0 resolved · 5 total in this PR vs main

Total breakdown: 🔶 2 High | 🟡 3 Medium


🔶 High · 2 findings
CVE Package Version Fix
CVE-2026-97689 urllib3 2.7.0 2.8.0
CVE-2026-97687 urllib3 2.7.0 2.8.0

🟡 Medium · 3 findings
CVE Package Version Fix
CVE-2026-49264 oauthlib 3.3.1 4.0.0
CVE-2026-49265 oauthlib 3.3.1 4.0.0
CVE-2026-97688 urllib3 2.7.0 2.8.0

View full analysis in Upwind Console

Scan completed in 15s

Scan history (1 scan)
Commit Scanned at New Resolved Net
458c4f3 < 2026-10-06 14:21 UTC +5 0 +5

Last scanned: 458c4f3 · 2026-10-06 14:21 UTC

@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Passed

0 misconfigurations detected

No default-branch baseline yet — showing all findings.

View full analysis in Upwind Console →

Scan completed in 2s

Scan history (1 scan)
Commit Scanned at New Resolved Net
458c4f3 < 2026-10-06 14:21 UTC 0 0 0

Last scanned: 458c4f3 · 2026-10-06 14:21 UTC

@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026

Copy link
Copy Markdown

Upwind Upwind Secrets Scan

2 findings detected

Total breakdown: 🔶 1 SECRET | 🔶 1 PII

No default-branch baseline yet — showing all findings.


🔶 SECRET · 1 finding
File Line Type Value
tests/release/integration/test_wrapper_k8s.py 79 generic-api-key inpu••••cret

🔶 PII · 1 finding
File Line Type Value
pyproject.toml 8 Email py••••@digital.ai

A secret that has been pushed remains in the repository's history even after the line is removed.

Scan completed in 3s.


Scan history (1 scan)
Commit Scanned at New Resolved Net
458c4f3 < 2026-10-06 14:21 UTC +2 0 +2

Last scanned: 458c4f3 · 2026-10-06 14:21 UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Signal/reporting races and worker-thread exit semantics can prevent reliable abort completion or produce incorrect results.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Adds abort-signal support and worker-thread task execution to the Python integration SDK.

Changes:

  • Adds cooperative abort state and updated abort semantics.
  • Handles SIGABRT/SIGTERM while tasks run in worker threads.
  • Adds documentation and abort-focused tests.
File Description
digitalai/​release/​integration/​base_task.py Adds abort state and context initialization.
digitalai/​release/​integration/​wrapper.py Adds threaded execution, signal handling, and guarded reporting.
tests/​release/​integration/​test_base_task.py Tests new abort behavior.
tests/​release/​integration/​test_wrapper_abort.py Tests signal and threading behavior.
tests/​release/​integration/​blocking_task.py Provides the blocking-task fixture.
docs/​examples.md Documents cooperative cancellation.
docs/​classes/​base_task.md Updates the BaseTask API reference.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

# the task finishes normally (worker thread's completion path) or is aborted
# (main thread's signal handler). Reset at the start of each execute_task()
# call so daemon-mode iterations each get a fresh guard.
_report_lock = threading.Lock()
Comment on lines +317 to +318
except Exception:
dai_logger.error("Unexpected error occurred.", exc_info=True)
Comment on lines +260 to +263
# Give the task time to enter its blocking sleep(30) call.
time.sleep(1.0)
start = time.monotonic()
proc.send_signal(signal.SIGABRT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants