-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.go
51 lines (44 loc) · 994 Bytes
/
worker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package cmd
import (
"os"
"github.com/urfave/cli/v2"
"github.com/galgotech/fermions-workflow/pkg/setting"
"github.com/galgotech/fermions-workflow/pkg/worker"
)
func Worker() error {
setting := setting.New().(*setting.FermionsSetting)
app := &cli.App{
Name: "fermions-workflow-worker",
Usage: "Workflow worker",
Authors: authors,
Flags: globalFlags(setting, true, true),
Commands: []*cli.Command{
{
Name: "run",
Usage: "",
Flags: []cli.Flag{
&cli.StringSliceFlag{
Name: "exec",
Usage: "exec workflow",
Required: true,
Action: func(c *cli.Context, exec []string) error {
setting.AddStart(exec)
return nil
},
},
},
Action: func(c *cli.Context) error {
fermionsWorker, err := worker.Initialize(setting)
if err != nil {
return err
}
return fermionsWorker.Execute()
},
},
},
}
if err := app.Run(os.Args); err != nil {
return err
}
return nil
}