-
Notifications
You must be signed in to change notification settings - Fork 850
Closed
Description
Problem
Dagger has the ability to run commands in containers (engine.#Exec). These commands can be long-running (for example a test database). But there is no reliable way to terminate this command later. This effectively makes it impossible to execute long-running commands without hanging DAG execution.
A typical example (from real-world use case #1227):
- Start a test database (
engine.#Exec) - Execute tests against test database (
engine.Exec) - After the tests aere completed, terminate the test database (this is the missing feature)
Solution
Here’s a suggestion to get us started:
package engine
// Terminate a task
#Terminate: {
// The ID of the task to terminate
id: #TaskID
}
// Each task produces a unique ID which can be safely referenced
// NOTE: not necessarily the same as our internal IDs
#Exec: {
// Dagger task ID.
target: #TaskID
…
}
Example:
sleep: engine.#Exec & {
args: [“sleep”, “100”]
}
terminate: engine.#Terminate & {
target: sleep.id
}
NOTE: in this example, sleep and terminate will run in parallel, causing sleep to be terminated immediately. For a more useful example, we need a way to run terminate after other commands. This requires explicit dependencies between tasks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels