How to write a Mesos framework(3)

agolangf · · 328 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>3.task status updates</p> <p>Task status is updated through mesos statusUpdate event.Mesos task statuses include:</p> <pre><code>TaskState_TASK_STAGING TaskState = 6 TaskState_TASK_STARTING TaskState = 0 TaskState_TASK_RUNNING TaskState = 1 // NOTE: This should only be sent when the framework has // the TASK_KILLING_STATE capability. TaskState_TASK_KILLING TaskState = 8 TaskState_TASK_FINISHED TaskState = 2 TaskState_TASK_FAILED TaskState = 3 TaskState_TASK_KILLED TaskState = 4 TaskState_TASK_ERROR TaskState = 7 // In Mesos 1.2, this will only be sent when the framework does NOT // opt-in to the PARTITION_AWARE capability. TaskState_TASK_LOST TaskState = 5 // The task failed to launch because of a transient error. The // task&#39;s executor never started running. Unlike TASK_ERROR, the // task description is valid -- attempting to launch the task again // may be successful. TaskState_TASK_DROPPED TaskState = 9 // The task was running on an agent that has lost contact with the // master, typically due to a network failure or partition. The task // may or may not still be running. TaskState_TASK_UNREACHABLE TaskState = 10 // The task is no longer running. This can occur if the agent has // been terminated along with all of its tasks (e.g., the host that // was running the agent was rebooted). It might also occur if the // task was terminated due to an agent or containerizer error, or if // the task was preempted by the QoS controller in an // oversubscription scenario. TaskState_TASK_GONE TaskState = 11 // The task was running on an agent that the master cannot contact; // the operator has asserted that the agent has been shutdown, but // this has not been directly confirmed by the master. If the // operator is correct, the task is not running and this is a // terminal state; if the operator is mistaken, the task may still // be running and might return to RUNNING in the future. TaskState_TASK_GONE_BY_OPERATOR TaskState = 12 // The master has no knowledge of the task. This is typically // because either (a) the master never had knowledge of the task, or // (b) the master forgot about the task because it garbage collected // its metadata about the task. The task may or may not still be // running. TaskState_TASK_UNKNOWN TaskState = 13 </code></pre> <p>sample codes of updated status:</p> <pre><code>func (s *Scheduler) status(status *mesos.TaskStatus) { state := status.GetState() taskId := status.TaskId.GetValue() switch state { case mesos.TaskState_TASK_STAGING: doSometing() case mesos.TaskState_TASK_STARTING: doSometing() case mesos.TaskState_TASK_RUNNING: doSometing() case mesos.TaskState_TASK_FINISHED: doSometing() case mesos.TaskState_TASK_FAILED: doSometing() case mesos.TaskState_TASK_KILLED: doSometing() case mesos.TaskState_TASK_LOST: doSometing() } } </code></pre> <p>more details please go to:<a href="https://github.com/Dataman-Cloud/swan" rel="nofollow">https://github.com/Dataman-Cloud/swan</a></p> <p><a href="https://www.reddit.com/r/golang/comments/5md143/how_to_write_a_mesos_framework_2/" rel="nofollow">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/" rel="nofollow">How to write a mesos framework (1)</a></p>

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

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