PremoWeb / chadburn

Chadburn is a scheduler alternative to cron, built on Go and designed for Docker environments.
MIT License
36 stars 4 forks source link

prevent deletion of jobs added through config file #45

Closed boindil closed 2 years ago

boindil commented 2 years ago

This solves #28

Local test with config file and container with labels:

scheduler.go:89 ▶ NOTICE New job registered "autoprint-fax" - "touch /tmp/example" - "@every 2m" - ID: 1
scheduler.go:101 ▶ DEBUG Starting scheduler
cron_utils.go:13 ▶ DEBUG start
cron_utils.go:13 ▶ DEBUG schedule
scheduler.go:89 ▶ NOTICE New job registered "test-exec-job" - "uname -a" - "@every 5s" - ID: 2
cron_utils.go:13 ▶ DEBUG added
cron_utils.go:13 ▶ DEBUG wake
cron_utils.go:13 ▶ DEBUG run
common.go:127 ▶ NOTICE [Job "test-exec-job" (1ecc7b7c2806)] Started - uname -a
common.go:127 ▶ NOTICE [Job "test-exec-job" (1ecc7b7c2806)] Output: Linux b4a818a67521 5.10.103-5.ph4-esx #1-photon SMP Sun May 1 05:01:24 UTC 2022 x86_64 GNU/Linux
common.go:127 ▶ NOTICE [Job "test-exec-job" (1ecc7b7c2806)] Finished in "56.294059ms", failed: false, skipped: false, error: none
cron_utils.go:13 ▶ DEBUG wake
cron_utils.go:13 ▶ DEBUG run
common.go:127 ▶ NOTICE [Job "test-exec-job" (09a25b986db2)] Started - uname -a
common.go:127 ▶ NOTICE [Job "test-exec-job" (09a25b986db2)] Output: Linux b4a818a67521 5.10.103-5.ph4-esx #1-photon SMP Sun May 1 05:01:24 UTC 2022 x86_64 GNU/Linux
common.go:127 ▶ NOTICE [Job "test-exec-job" (09a25b986db2)] Finished in "49.752522ms", failed: false, skipped: false, error: none
cron_utils.go:13 ▶ DEBUG wake
cron_utils.go:13 ▶ DEBUG run
common.go:127 ▶ NOTICE [Job "test-exec-job" (e36f4735d8cb)] Started - uname -a
common.go:127 ▶ NOTICE [Job "test-exec-job" (e36f4735d8cb)] Output: Linux b4a818a67521 5.10.103-5.ph4-esx #1-photon SMP Sun May 1 05:01:24 UTC 2022 x86_64 GNU/Linux
common.go:127 ▶ NOTICE [Job "test-exec-job" (e36f4735d8cb)] Finished in "49.346655ms", failed: false, skipped: false, error: none
cron_utils.go:13 ▶ DEBUG wake
cron_utils.go:13 ▶ DEBUG run
common.go:127 ▶ NOTICE [Job "test-exec-job" (ac3e5aaea306)] Started - uname -a
common.go:123 ▶ ERROR [Job "test-exec-job" (ac3e5aaea306)] Finished in "920.935µs", failed: true, skipped: false, error: error creating exec: No such container: heuristic_heyrovsky
scheduler.go:94 ▶ NOTICE Job deregistered (will not fire again) "test-exec-job" - "uname -a" - "@every 5s" - ID: 2
cron_utils.go:13 ▶ DEBUG removed
cron_utils.go:13 ▶ DEBUG wake
cron_utils.go:13 ▶ DEBUG run
common.go:127 ▶ NOTICE [Job "autoprint-fax" (0edb5fa1913c)] Started - touch /tmp/example
common.go:127 ▶ NOTICE [Job "autoprint-fax" (0edb5fa1913c)] Finished in "53.31728ms", failed: false, skipped: false, error: none

The config file now gets loaded correctly and any containers with labels get loaded and unloaded correctly.

maietta commented 2 years ago

I'm not sure, but I believe the cause of this failure of tests relate to a 3rd party dependency that will be removed in 2.x. I'll try and find a little time to address this today-- but no promises.