Details

      Description

      /v2/apps/{app_id}/tasks returns state as a string.

      {
        "tasks": [
          {
            "ipAddresses": [
              {
                "ipAddress": "192.168.33.10",
                "protocol": "IPv4"
              }
            ],
            "stagedAt": "2017-10-03T23:25:01.820Z",
            "state": "TASK_RUNNING",
            "ports": [
              31231
            ],
            "startedAt": "2017-10-03T23:25:02.232Z",
            "version": "2017-10-03T23:25:00.876Z",
            "id": "sleeper.144cac69-a892-11e7-85d1-acde48001122",
            "appId": "/sleeper",
            "slaveId": "a97f26e3-65ba-4490-9059-524ab0b0848b-S0",
            "host": "mesos-1.dev.vagrant"
          }
        ]
      }
      

      -X DELETE /v2/apps/{app_id}/tasks/{task_id} returns the following:

      {
        "task": {
          "instanceId": {
            "idString": "sleeper.marathon-144cac69-a892-11e7-85d1-acde48001122"
          },
          "agentInfo": {
            "host": "mesos-1.dev.vagrant",
            "agentId": "a97f26e3-65ba-4490-9059-524ab0b0848b-S0",
            "attributes": []
          },
          "tasksMap": {
            "sleeper.144cac69-a892-11e7-85d1-acde48001122": {
              "taskId": "sleeper.144cac69-a892-11e7-85d1-acde48001122",
              "runSpecVersion": "2017-10-03T23:25:00.876Z",
              "status": {
                "stagedAt": "2017-10-03T23:25:01.820Z",
                "startedAt": "2017-10-03T23:25:02.232Z",
                "mesosStatus": "Ci4KLHNsZWVwZXIuMTQ0Y2FjNjktYTg5Mi0xMWU3LTg1ZDEtYWNkZTQ4MDAxMTIyEAEqKQonYTk3ZjI2ZTMtNjViYS00NDkwLTkwNTktNTI0YWIwYjA4NDhiLVMwMW4bvRMHddZBOi4KLHNsZWVwZXIuMTQ0Y2FjNjktYTg5Mi0xMWU3LTg1ZDEtYWNkZTQ4MDAxMTIySAJaEBtLkjp3jkwZhIxoDugLxjBqPgoRKg8SDTE5Mi4xNjguMzMuMTAYjDAiJgokYmQxOWE4N2YtMTc1YS00NzZkLThlMzgtYmU0NDhmZjRlZWRi",
                "condition": "Running",
                "networkInfo": {
                  "hostName": "mesos-1.dev.vagrant",
                  "hostPorts": [
                    31231
                  ],
                  "ipAddresses": [
                    {
                      "ipAddress": "192.168.33.10",
                      "protocol": "IPv4"
                    }
                  ]
                }
              }
            }
          },
          "runSpecVersion": "2017-10-03T23:25:00.876Z",
          "state": {
            "condition": "Running",
            "since": "2017-10-03T23:25:02.232Z",
            "activeSince": "2017-10-03T23:25:02.232Z"
          },
          "unreachableStrategy": {
            "inactiveAfterSeconds": 0,
            "expungeAfterSeconds": 0
          }
        }
      }
      ...
      

      This is clearly an API error. The API should be fixed such that the delete response format matches the list tasks format.

      The issue is that in the /v2/apps/{app_id}/tasks call, we serialize the type EnrichedTask:

      https://github.com/mesosphere/marathon/blob/v1.5.1/src/main/scala/mesosphere/marathon/api/v2/AppTasksResource.scala#L59

      However, in DELETE /v2/apps{app_id}/tasks/{task_id}, we serialize the type task directly, and a different (internal) formatter is used:

      https://github.com/mesosphere/marathon/blob/v1.5.1/src/main/scala/mesosphere/marathon/api/v2/AppTasksResource.scala#L115

      The API raml advertises that these two endpoints should respond with the same task schema.

      Acceptance

      Given a running Marathon instance with an app running, and some task
      When we kill the task using the API
      Then the JSON response format describing the killed task should match the format seen in /v2/tasks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kjeschkies Karsten Jeschkies
                Reporter:
                tharper Tim Harper
                Team:
                Orchestration Team
                Watchers:
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: