m3dev/kannon

Not waiting for the first TaskOnBullet to be completed

yokomotod opened this issue · 2 comments

If the first task is kannon.TaskOnBullet, the current master job seems to exit without waiting for its completion.

from time import sleep
import kannon
from kubernetes import config, client


class Example(kannon.TaskOnBullet):
    def run(self):
        sleep(5 * 60)


config.load_incluster_config()
kannon.Kannon(
    api_instance=client.BatchV1Api(),
    namespace='mynamespace',
    image_name='myimage',
    container_name='mycontainer',
    job_prefix='mychild',
    path_child_script='./scripts/run_child.py',
    env_to_inherit=[],
    service_account_name='my-service-account',
).build(Example())
$ kubectl -n mynamespace get po -w
NAME                                                   READY   STATUS              RESTARTS   AGE
mymaster-6swxq                                    1/1     Running             0          119s
mychild-example-074-20230406152425-cbtfg            0/1     Pending             0          0s
mychild-example-074-20230406152425-cbtfg            0/1     Pending             0          0s
mychild-example-074-20230406152425-cbtfg            0/1     ContainerCreating   0          0s
mychild-example-074-20230406152425-cbtfg            1/1     Running             0          1s
mymaster-6swxq                                    0/1     Completed           0          2m6s
mymaster-6swxq                                    0/1     Completed           0          2m8s

Sorry for the late response!
Thanks for the bug report. I'll work on it soon.

Resolved by #14