Feat v0.7.12 batch exec (#66)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m46s
CI/CD / test-sqlite (push) Successful in 2m58s
CI/CD / build-and-deploy (push) Successful in 1m27s
CI/CD / test-frontend (push) Successful in 5s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m46s
CI/CD / test-sqlite (push) Successful in 2m58s
CI/CD / build-and-deploy (push) Successful in 1m27s
CI/CD / test-frontend (push) Successful in 5s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #66.
This commit is contained in:
@@ -242,6 +242,39 @@ instances = workflow.list_instances(workflow_id, status="active")
|
||||
# Returns list of instance dicts
|
||||
```
|
||||
|
||||
### batch
|
||||
|
||||
**Permission:** `batch.exec`
|
||||
|
||||
Run multiple callables concurrently. Each callable gets its own
|
||||
execution thread with an independent step budget.
|
||||
|
||||
```python
|
||||
jira = lib.require("jira-client")
|
||||
confluence = lib.require("confluence-client")
|
||||
|
||||
results, errors = batch.exec([
|
||||
lambda: jira.create_issue(issue_data),
|
||||
lambda: confluence.create_page(page_data),
|
||||
lambda: send_notification(user_id),
|
||||
], timeout=15)
|
||||
|
||||
# results[i] = return value of callables[i], or None on error
|
||||
# errors[i] = None on success, or error string on failure
|
||||
# All three ran concurrently.
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- Max 8 callables per call. Dispatched concurrently via goroutines.
|
||||
- `timeout` (optional): 1–30 seconds per branch (default 10).
|
||||
- `lib.require()` is not available inside branch callables.
|
||||
Load libraries before the `batch.exec` call.
|
||||
- `batch.exec()` cannot be called from within a branch (no nesting).
|
||||
- `print()` output from branches is discarded.
|
||||
|
||||
---
|
||||
|
||||
## Example: automated stage hook
|
||||
|
||||
A simple hook that reads a setting, queries data, and advances:
|
||||
|
||||
Reference in New Issue
Block a user