1.png
    设置了cron,结果cron的结果是一直pending
    2.png先cancel再执行,就可以正确运行。
    3.png好像是因为没有给分配节点
    4.png
    Random node 可能不大行
    4.png
    但是选了all,指定好执行的node,也一直在pending
    5.png
    6.png
    Cancel后再restart就可以执行成功。
    7.png

    而且日志是空的:
    image.png
    设置了59分钟执行一次的cron,结果出来了一堆任务,明显间隔远小于59分钟
    image.png
    docker中的日志:

    1. [GIN] 2021/12/14 - 17:19:44 | 200 | 1.687052ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    2. [GIN] 2021/12/14 - 17:19:44 | 200 | 1.805117ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    3. [GIN] 2021/12/14 - 17:19:44 | 200 | 1.66901ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    4. [GIN] 2021/12/14 - 17:19:49 | 200 | 1.989707ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64"
    5. [GIN] 2021/12/14 - 17:19:49 | 200 | 1.752247ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    6. [GIN] 2021/12/14 - 17:19:49 | 200 | 1.72434ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64"
    7. [GIN] 2021/12/14 - 17:19:49 | 200 | 2.052601ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64"
    8. [GIN] 2021/12/14 - 17:19:49 | 200 | 1.725489ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    9. [GIN] 2021/12/14 - 17:19:49 | 200 | 1.795195ms | 127.0.0.1 | GET "/tasks/61b8511cb3dff6964e219f64/logs?page=1&size=1000"
    10. [GIN] 2021/12/14 - 17:19:53 | 200 | 9.621834ms | 127.0.0.1 | GET "/nodes?all=true"
    11. [GIN] 2021/12/14 - 17:19:53 | 200 | 3.065192ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    12. [GIN] 2021/12/14 - 17:19:53 | 200 | 9.633242ms | 127.0.0.1 | GET "/spiders?all=true"
    13. [GIN] 2021/12/14 - 17:19:58 | 200 | 3.447695ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    14. [GIN] 2021/12/14 - 17:20:03 | 200 | 3.371247ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    15. [GIN] 2021/12/14 - 17:20:08 | 200 | 3.678794ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    16. [GIN] 2021/12/14 - 17:20:13 | 200 | 3.382504ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    17. [GIN] 2021/12/14 - 17:20:18 | 200 | 3.058961ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    18. [GIN] 2021/12/14 - 17:20:23 | 200 | 3.091996ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    19. [GIN] 2021/12/14 - 17:20:28 | 200 | 3.094828ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    20. [GIN] 2021/12/14 - 17:20:33 | 200 | 3.11339ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    21. [GIN] 2021/12/14 - 17:20:38 | 200 | 3.062865ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    22. [GIN] 2021/12/14 - 17:20:43 | 200 | 3.064497ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    23. [GIN] 2021/12/14 - 17:20:48 | 200 | 3.093133ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    24. [GIN] 2021/12/14 - 17:20:53 | 200 | 3.360337ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    25. [GIN] 2021/12/14 - 17:20:58 | 200 | 3.534331ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    26. 2021/12/14 17:21:00 info cron: wake now 2021-12-14 17:21:00.000896405 +0800 CST
    27. 2021/12/14 17:21:00 info cron: run now 2021-12-14 17:21:00.000896405 +0800 CST entry 1 next 2021-12-14 17:24:00 +0800 CST
    28. 2021/12/14 17:21:00 error cron: panic stack ...
    29. goroutine 204019 [running]:
    30. github.com/robfig/cron/v3.Recover.func1.1.1(0x141aa90, 0x1b06f30)
    31. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/chain.go:45 +0xbd
    32. panic(0x1081fc0, 0x1ab6cd0)
    33. /usr/local/go/src/runtime/panic.go:965 +0x1b9
    34. github.com/crawlab-team/crawlab-core/models/models.(*User).GetId(0x0, 0x0, 0xc000000000)
    35. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/models/user.go:17 +0x17
    36. github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).upsertArtifact(0xc0055b5bc0, 0x1199ec0, 0xc005369560)
    37. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:300 +0x438
    38. github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).add(0xc0055b5bc0, 0x5, 0x0)
    39. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:182 +0x10a
    40. github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).do(0xc0055b5bc0, 0x11f63da, 0x3, 0x1431208, 0xc0055b5bc0)
    41. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:148 +0x94
    42. github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).Add(0xc0055b5bc0, 0xc005369560, 0xc004d4fd70)
    43. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:106 +0x45
    44. github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).Enqueue(0xc0001b29c0, 0x143a938, 0xc005369560, 0x1, 0x1)
    45. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/task/scheduler/service.go:61 +0x169
    46. github.com/crawlab-team/crawlab-core/spider/admin.(*Service).scheduleTasks(0xc00009fe40, 0xc00537ec58, 0xc0000e77a0, 0xc00537ec58, 0x0)
    47. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/spider/admin/service.go:111 +0x3e2
    48. github.com/crawlab-team/crawlab-core/spider/admin.(*Service).Schedule(0xc00009fe40, 0x96f6dfb38ceeb761, 0x600646eec9e214e, 0xc0000e77a0, 0x0, 0x0)
    49. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/spider/admin/service.go:45 +0x85
    50. github.com/crawlab-team/crawlab-core/schedule.(*Service).schedule.func1()
    51. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/schedule/service.go:235 +0x489
    52. github.com/robfig/cron/v3.FuncJob.Run(0xc001ba66c0)
    53. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:131 +0x25
    54. github.com/robfig/cron/v3.Recover.func1.1()
    55. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/chain.go:53 +0x68
    56. github.com/robfig/cron/v3.FuncJob.Run(0xc0011987e0)
    57. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:131 +0x25
    58. github.com/robfig/cron/v3.(*Cron).startJob.func1(0xc00043afa0, 0x1411fe0, 0xc0011987e0)
    59. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:307 +0x65
    60. created by github.com/robfig/cron/v3.(*Cron).startJob
    61. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:305 +0x73
    62. runtime error: invalid memory address or nil pointer dereference
    63. /go/pkg/mod/github.com/crawlab-team/go-trace@v0.1.0/trace.go:6 github.com/crawlab-team/go-trace.PrintError()
    64. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/schedule/logger.go:22 github.com/crawlab-team/crawlab-core/schedule.(*Logger).Error()
    65. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/chain.go:50 github.com/robfig/cron/v3.Recover.func1.1.1()
    66. /usr/local/go/src/runtime/panic.go:965 runtime.gopanic()
    67. /usr/local/go/src/runtime/panic.go:212 runtime.panicmem()
    68. /usr/local/go/src/runtime/signal_unix.go:734 runtime.sigpanic()
    69. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/models/user.go:17 github.com/crawlab-team/crawlab-core/models/models.(*User).GetId()
    70. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:300 github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).upsertArtifact()
    71. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:182 github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).add()
    72. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:148 github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).do()
    73. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/models/delegate/model.go:106 github.com/crawlab-team/crawlab-core/models/delegate.(*ModelDelegate).Add()
    74. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/task/scheduler/service.go:61 github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).Enqueue()
    75. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/spider/admin/service.go:111 github.com/crawlab-team/crawlab-core/spider/admin.(*Service).scheduleTasks()
    76. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/spider/admin/service.go:45 github.com/crawlab-team/crawlab-core/spider/admin.(*Service).Schedule()
    77. /go/pkg/mod/github.com/crawlab-team/crawlab-core@v0.6.0-beta.20211122.1338/schedule/service.go:235 github.com/crawlab-team/crawlab-core/schedule.(*Service).schedule.func1()
    78. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:131 github.com/robfig/cron/v3.FuncJob.Run()
    79. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/chain.go:53 github.com/robfig/cron/v3.Recover.func1.1()
    80. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:131 github.com/robfig/cron/v3.FuncJob.Run()
    81. /go/pkg/mod/github.com/robfig/cron/v3@v3.0.0/cron.go:307 github.com/robfig/cron/v3.(*Cron).startJob.func1()
    82. /usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
    83. [GIN] 2021/12/14 - 17:21:03 | 200 | 3.185996ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    84. [GIN] 2021/12/14 - 17:21:08 | 200 | 3.107337ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    85. [GIN] 2021/12/14 - 17:21:13 | 200 | 3.191596ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    86. [GIN] 2021/12/14 - 17:21:18 | 200 | 3.08863ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    87. [GIN] 2021/12/14 - 17:21:23 | 200 | 3.146218ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    88. [GIN] 2021/12/14 - 17:21:28 | 200 | 3.17616ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    89. [GIN] 2021/12/14 - 17:21:33 | 200 | 3.229348ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    90. [GIN] 2021/12/14 - 17:21:38 | 200 | 3.334611ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    91. [GIN] 2021/12/14 - 17:21:43 | 200 | 3.238885ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    92. [GIN] 2021/12/14 - 17:21:48 | 200 | 4.099721ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    93. [GIN] 2021/12/14 - 17:21:53 | 200 | 3.074866ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    94. [GIN] 2021/12/14 - 17:21:58 | 200 | 3.35473ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    95. [GIN] 2021/12/14 - 17:22:03 | 200 | 4.329431ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    96. [GIN] 2021/12/14 - 17:22:08 | 200 | 6.963332ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    97. [GIN] 2021/12/14 - 17:22:13 | 200 | 3.073611ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    98. [GIN] 2021/12/14 - 17:22:18 | 200 | 3.091466ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    99. [GIN] 2021/12/14 - 17:22:23 | 200 | 3.091449ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    100. [GIN] 2021/12/14 - 17:22:28 | 200 | 5.297851ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"
    101. [GIN] 2021/12/14 - 17:22:33 | 200 | 3.253731ms | 127.0.0.1 | GET "/schedules?page=1&size=10&conditions=[]&sort=[]"

    查看主节点的工作:
    image.png