opsxcq / tasker

Tasker is a multipurpose task runner
195 stars 17 forks source link

Error removing container when task takes longer to run than what as scheduled #9

Open yangm97 opened 5 years ago

yangm97 commented 5 years ago
version: "2"

services:
  tasker:
    image: strm/tasker
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      configuration: |
        logging:
          level:
            ROOT: INFO
            org.springframework.web: INFO
        schedule:
          - every: minute
            task: hello
        tasks:
          docker:
            - name: hello
              image: debian:jessie
              script:
                - echo Hello world from Tasker
                - sleep 150
tasker_1  | 2019-11-01 13:33:59.969  INFO 6 --- [pool-2-thread-1] sh.strm.tasker.runner.DockerTaskRunner   : Starting the execution of the hello task
tasker_1  | 2019-11-01 13:34:02.151 ERROR 6 --- [pool-2-thread-1] sh.strm.tasker.runner.DockerTaskRunner   : Error running hello task, error:Request error: DELETE unix://localhost:80/containers/8cf227efe7056af830659b27e5cd5cec77956156178b837d26d79f61709f8b01: 409, body: {"message":"You cannot remove a running container 8cf227efe7056af830659b27e5cd5cec77956156178b837d26d79f61709f8b01. Stop the container before attempting removal or force remove"}
tasker_1  | 
tasker_1  | 
tasker_1  | com.spotify.docker.client.exceptions.DockerRequestException: Request error: DELETE unix://localhost:80/containers/8cf227efe7056af830659b27e5cd5cec77956156178b837d26d79f61709f8b01: 409, body: {"message":"You cannot remove a running container 8cf227efe7056af830659b27e5cd5cec77956156178b837d26d79f61709f8b01. Stop the container before attempting removal or force remove"}
tasker_1  | 
tasker_1  |     at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2649) ~[docker-client-8.9.0.jar!/:8.9.0]
tasker_1  |     at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2610) ~[docker-client-8.9.0.jar!/:8.9.0]
tasker_1  |     at com.spotify.docker.client.DefaultDockerClient.removeContainer(DefaultDockerClient.java:809) ~[docker-client-8.9.0.jar!/:8.9.0]
tasker_1  |     at com.spotify.docker.client.DefaultDockerClient.removeContainer(DefaultDockerClient.java:789) ~[docker-client-8.9.0.jar!/:8.9.0]
tasker_1  |     at sh.strm.tasker.util.Docker.removeContainer(Docker.java:193) ~[classes!/:0.0.1-SNAPSHOT]
tasker_1  |     at sh.strm.tasker.runner.DockerTaskRunner.executeTask(DockerTaskRunner.java:62) ~[classes!/:0.0.1-SNAPSHOT]
tasker_1  |     at sh.strm.tasker.runner.DockerTaskRunner.executeTask(DockerTaskRunner.java:24) ~[classes!/:0.0.1-SNAPSHOT]
tasker_1  |     at sh.strm.tasker.runner.Runner.execute(Runner.java:20) ~[classes!/:0.0.1-SNAPSHOT]
tasker_1  |     at sh.strm.tasker.schedule.SchedulerSetup.lambda$init$0(SchedulerSetup.java:74) [classes!/:0.0.1-SNAPSHOT]
tasker_1  |     at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
tasker_1  |     at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
tasker_1  |     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_111]
tasker_1  |     at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_111]
tasker_1  | Caused by: javax.ws.rs.ClientErrorException: HTTP 409 Conflict
tasker_1  |     at org.glassfish.jersey.client.JerseyInvocation.createExceptionForFamily(JerseyInvocation.java:1056) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1039) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:819) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.JerseyInvocation$5.completed(JerseyInvocation.java:776) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime.processResponse(ClientRuntime.java:196) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime.access$300(ClientRuntime.java:74) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime$2$1$1.run(ClientRuntime.java:166) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime$2$1.response(ClientRuntime.java:164) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:491) ~[jersey-apache-connector-2.22.2.jar!/:na]
tasker_1  |     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
tasker_1  |     at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299) ~[jersey-guava-2.25.1.jar!/:na]
tasker_1  |     at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) ~[na:1.8.0_111]
tasker_1  |     at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) ~[jersey-guava-2.25.1.jar!/:na]
tasker_1  |     at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:37) ~[jersey-guava-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:487) ~[jersey-apache-connector-2.22.2.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:180) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340) ~[jersey-common-2.25.1.jar!/:na]
tasker_1  |     at org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:208) ~[jersey-client-2.25.1.jar!/:na]
tasker_1  |     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_111]
tasker_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
tasker_1  |     ... 3 common frames omitted
tasker_1  |