This is an automated email from the ASF dual-hosted git repository. klueska pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push: new fcb8e2a Updated 'mesos task list' to display a 'State' field. fcb8e2a is described below commit fcb8e2abeef52042a7f40312c461cab716c0bf3c Author: Armand Grillet <agril...@mesosphere.io> AuthorDate: Thu Nov 22 11:17:43 2018 -0500 Updated 'mesos task list' to display a 'State' field. Review: https://reviews.apache.org/r/69393/ --- src/python/cli_new/lib/cli/plugins/task/main.py | 7 ++++++- src/python/cli_new/lib/cli/tests/task.py | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/python/cli_new/lib/cli/plugins/task/main.py b/src/python/cli_new/lib/cli/plugins/task/main.py index 0536ccb..4abc70a 100644 --- a/src/python/cli_new/lib/cli/plugins/task/main.py +++ b/src/python/cli_new/lib/cli/plugins/task/main.py @@ -120,9 +120,14 @@ class Task(PluginBase): return try: - table = Table(["Task ID", "Framework ID", "Executor ID"]) + table = Table(["ID", "State", "Framework ID", "Executor ID"]) for task in tasks: + task_state = "UNKNOWN" + if task["statuses"]: + task_state = task["statuses"][-1]["state"] + table.add_row([task["id"], + task_state, task["framework_id"], task["executor_id"]]) except Exception as exception: diff --git a/src/python/cli_new/lib/cli/tests/task.py b/src/python/cli_new/lib/cli/tests/task.py index f033b4a..1b48c0a 100644 --- a/src/python/cli_new/lib/cli/tests/task.py +++ b/src/python/cli_new/lib/cli/tests/task.py @@ -180,13 +180,15 @@ class TestTaskPlugin(CLITestCase): # and that they are formatted as expected, # with the proper task info in them. self.assertEqual(table.dimensions()[0], 2) - self.assertEqual(table.dimensions()[1], 3) - self.assertEqual("Task ID", table[0][0]) - self.assertEqual("Framework ID", table[0][1]) - self.assertEqual("Executor ID", table[0][2]) + self.assertEqual(table.dimensions()[1], 4) + self.assertEqual("ID", table[0][0]) + self.assertEqual("State", table[0][1]) + self.assertEqual("Framework ID", table[0][2]) + self.assertEqual("Executor ID", table[0][3]) self.assertEqual(tasks[0]["id"], table[1][0]) - self.assertEqual(tasks[0]["framework_id"], table[1][1]) - self.assertEqual(tasks[0]["executor_id"], table[1][2]) + self.assertEqual("UNKNOWN", table[1][1]) + self.assertEqual(tasks[0]["framework_id"], table[1][2]) + self.assertEqual(tasks[0]["executor_id"], table[1][3]) # Kill the task, agent, and master. task.kill()