Propagate cancellation and preserve resumable state
This commit is contained in:
@@ -11,6 +11,9 @@ func composeInvocation(runtime *invocationRuntime) error {
|
||||
stages := runtime.stages
|
||||
dependencies := runtime.dependencies
|
||||
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.WhisperX == nil && stagesContainAny(stages, "transcribe") {
|
||||
client, err := dependencies.newWhisperX(env.Config)
|
||||
if err != nil {
|
||||
@@ -18,6 +21,9 @@ func composeInvocation(runtime *invocationRuntime) error {
|
||||
}
|
||||
env.WhisperX = client
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.Seriatim == nil && stagesContainAny(stages, "merge", "normalize", "trim", "render") {
|
||||
runner, err := dependencies.newSeriatim(env.Config)
|
||||
if err != nil {
|
||||
@@ -25,6 +31,9 @@ func composeInvocation(runtime *invocationRuntime) error {
|
||||
}
|
||||
env.Seriatim = runner
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.Audita == nil && stagesContainAny(stages, "polish") {
|
||||
runner, err := dependencies.newAudita(env.Config)
|
||||
if err != nil {
|
||||
@@ -32,12 +41,21 @@ func composeInvocation(runtime *invocationRuntime) error {
|
||||
}
|
||||
env.Audita = runner
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.Notarius == nil && needsNotariusForRun(env.Config, stages) {
|
||||
env.Notarius = dependencies.newNotarius()
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.Scriptorium == nil && stagesContainAny(stages, "trim", "analyze") {
|
||||
env.Scriptorium = dependencies.newScriptorium()
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.ObjectStore == nil && needsObjectStoreForRun(env.Config, stages, runtime.effectiveArtifacts) {
|
||||
objectStore, err := dependencies.newObjectStore(runtime.ctx, env.Config)
|
||||
if err != nil {
|
||||
@@ -45,8 +63,11 @@ func composeInvocation(runtime *invocationRuntime) error {
|
||||
}
|
||||
env.ObjectStore = objectStore
|
||||
}
|
||||
if err := runtime.ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
if env.Notifier == nil && stagesContainAny(stages, "notify") {
|
||||
env.Notifier = ¬ify.NoopSender{}
|
||||
}
|
||||
return nil
|
||||
return runtime.ctx.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user