Commit eae8a7b
Add background task system for long-running operations
Implements a multi-user safe background task manager for operations
that may exceed MCP connection timeouts (e.g., catalog cloning).
New tools:
- clone_catalog_async: Start clone in background, returns task_id
- get_task_status: Check progress and retrieve results
- list_tasks: List user's tasks with optional filtering
- cancel_task: Cancel pending/running tasks
Key features:
- Tasks isolated by user (from credentials)
- Thread-safe with RLock for all state access
- Progress tracking with step/percent/message
- Auto-cleanup of old completed tasks
- Extensible TaskType enum for future operations
- Graceful shutdown via atexit handler
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent ed58058 commit eae8a7b
File tree
4 files changed
+941
-0
lines changed- src/deriva_ml_mcp
- tools
4 files changed
+941
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
506 | 507 | | |
507 | 508 | | |
508 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
509 | 544 | | |
510 | 545 | | |
511 | 546 | | |
| |||
517 | 552 | | |
518 | 553 | | |
519 | 554 | | |
| 555 | + | |
520 | 556 | | |
521 | 557 | | |
522 | 558 | | |
| |||
541 | 577 | | |
542 | 578 | | |
543 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
544 | 595 | | |
545 | 596 | | |
546 | 597 | | |
| |||
0 commit comments