How to write a Mesos framework(4)

xuanbao · · 651 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<ol> <li>Delete task</li> </ol> <p>Task deletion by sending Mesos Call_KILL protobuf package,with the task ID attached which was supposed to be killed.</p> <pre><code>func (s *Scheduler) KillTask(task *types.Task)(*http.Response, error) { call := &amp;sched.Call{ FrameworkId: s.framework.GetId(), Type: sched.Call_KILL.Enum(), Kill: &amp;sched.Call_Kill{ TaskId: &amp;mesos.TaskID{ Value: proto.String(task.ID), }, AgentId: &amp;mesos.AgentID{ Value: task.AgentId, }, }, } duration := proto.Int64(task.KillPolicy.Duration * 1000 * 1000) if task.KillPolicy != nil { if task.KillPolicy.Duration != 0 { call.Kill.KillPolicy = &amp;mesos.KillPolicy{ GracePeriod: &amp;mesos.DurationInfo{ Nanoseconds: duration, }, } } } return s.send(call) } </code></pre> <p><code>Type</code> means the type of protobuf package .FrameworkId appoints the ID that current framework was registered in, <code>Mesos.task.ID</code> indicates the task ID that need to be kiled and <code>task.AgentId</code> appoints the agentId of the task need to be killed. </p> <p>killPolicy is a customized policy about graceful termination. During the process of graceful termination, Mesos will send the task a SIGTERM signal indicates that the very task is supposed to be exit. If the task does not exit as expected within a certain interval, SIGKILL will be send to the task to kill it by force, the interval can be changed by the <code>duration</code> field in the message, default value is 3s.</p> <p>more details please go to:<a href="https://github.com/Dataman-Cloud/swan">https://github.com/Dataman-Cloud/swan</a></p> <p><a href="https://www.reddit.com/r/golang/comments/5ofhwl/how_to_write_a_mesos_framework3/">How to write a mesos framework (3)</a></p> <p><a href="https://www.reddit.com/r/golang/comments/5md143/how_to_write_a_mesos_framework_2/">How to write a mesos framework (2)</a></p> <p><a href="https://www.reddit.com/r/mesos/comments/5kdb52/how_to_write_a_mesos_framework_1/">How to write a mesos framework (1)</a></p>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

651 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传