MCPcopy Create free account
hub / github.com/crossjoin-io/crossjoin / StartWorkflow

Method StartWorkflow

api/workflows.go:18–36  ·  view source on GitHub ↗
(hash, id string, workflowInput map[string]interface{})

Source from the content-addressed store, hash-verified

16}
17
18func (api *API) StartWorkflow(hash, id string, workflowInput map[string]interface{}) error {
19 // Create a workflow run
20 workflowRunID, err := uuid.NewRandom()
21 if err != nil {
22 return err
23 }
24 _, err = api.db.Exec(`INSERT INTO workflow_runs (id, config_hash, workflow_id, started_at)
25 VALUES ($1, $2, $3, datetime('now'))`, workflowRunID.String(), hash, id)
26 if err != nil {
27 return err
28 }
29
30 workflow, err := api.GetWorkflow(hash, id)
31 if err != nil {
32 return err
33 }
34
35 return api.ScheduleTask(workflowRunID.String(), workflow.Start, workflowInput)
36}
37
38func (api *API) CompleteWorkflowRun(id string, success bool) error {
39 _, err := api.db.Exec("UPDATE workflow_runs SET completed_at = datetime('now'), success = $1 WHERE id = $2",

Callers 2

refreshDatasetMethod · 0.95
postWorkflowsStartMethod · 0.95

Calls 3

GetWorkflowMethod · 0.95
ScheduleTaskMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected