~james/core

core/spindle/models/engine.go -rw-r--r-- 710 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 14 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package models

import (
	"context"
	"time"

	"tangled.org/core/spindle/secrets"
	"tangled.org/core/workflow"
)

const MaxWorkflowTimeBudget = 6 * time.Hour

func WorkflowTimeBudget(configured time.Duration) time.Duration {
	return min(configured, MaxWorkflowTimeBudget)
}

type Engine interface {
	InitWorkflow(twf workflow.WorkflowSpec, tpl workflow.PipelineSpec) (*Workflow, error)
	SetupWorkflow(ctx context.Context, wid WorkflowId, wf *Workflow, wfLogger WorkflowLogger) error
	WorkflowTimeout() time.Duration
	DestroyWorkflow(ctx context.Context, wid WorkflowId) error
	RunStep(ctx context.Context, wid WorkflowId, w *Workflow, idx int, secrets []secrets.UnlockedSecret, wfLogger WorkflowLogger) error
}