-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain2w.go
48 lines (41 loc) · 1016 Bytes
/
main2w.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
package main
// import (
// "fmt"
// "log"
// "time"
// "github.com/golang-collections/collections/queue"
// "github.com/google/uuid"
// "github.com/vishalvivekm/cube/task"
// "github.com/vishalvivekm/cube/worker"
// )
// func main() {
// db := make(map[uuid.UUID]*task.Task)
// w := worker.Worker{
// Queue: *queue.New(),
// Db: db,
// }
// t := task.Task{
// ID: uuid.New(),
// Name: "test-container-1",
// State: task.Scheduled,
// // Image: "strm/helloworld-http",
// Image: "vishalvivekm/to-do-app",
// }
// fmt.Println("starting task")
// w.AddTask(t)
// res := w.RunTask()
// if res.Error != nil {
// log.Fatalln(res.Error)
// }
// t.ContainerID = res.ContainerId
// fmt.Printf("task %s in container %s\n", t.ID, t.ContainerID)
// fmt.Println("sleeping...")
// time.Sleep(time.Second * 60)
// fmt.Printf("stopping task %s\n", t.ID)
// t.State = task.Completed
// w.AddTask(t)
// res = w.RunTask()
// if res.Error != nil {
// log.Fatalln(res.Error)
// }
// }