mesos / mesos-go

Go language bindings for Apache Mesos
Apache License 2.0
545 stars 146 forks source link

send kill-task and receive malformed request #307

Closed ghost closed 7 years ago

ghost commented 7 years ago

I tried to implement the code of killtask, but I got the malformed request infomation with err; code:

events.Handle(executor.Event_KILL, events.HandlerFunc(func(e *executor.Event) error {
    log.Println(e.GetKill())
    resp, err := state.cli.Do(httpcli.With(e.GetKill()))
    if resp != nil {
         defer resp.Close()
      }
       **log.Println(err)**
       if err != nil && err != io.EOF {
              **log.Println(err)**
        } else {
             log.Println("disconnected")
        }
}

Please give me some advice, thanks for your reply;

jdef commented 7 years ago

What do you expect the above code to do? A custom executor that receives a kill event should kill the task identified by the event. It looks to me like your code above is attempting to reflect the kill event back to mesos, which is incorrect. At first glance, I'm not even sure how the above code compiles.

See the Mesos docs for more details regarding the v1 executor API: https://github.com/apache/mesos/blob/1da4e45b8077b9046bba1a7ed15be5e344a14a91/docs/executor-http-api.md#kill

jdef commented 7 years ago

please re-open (and provide additional details, logs, etc) if this is still a problem for you.