Uploaded image for project: 'Marathon'
  1. Marathon
  2. MARATHON-7518

Marathon returns inconsistent timestamp strings when there are 0 milliseconds

    Details

      Description

      May not be a bug depending on your perspective.

      In the marathon RAML spec it says it uses `datetime`.

      https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#date

       

      But the call chain:

      https://github.com/mesosphere/marathon/blob/master/src/main/scala/mesosphere/marathon/raml/AppConversion.scala#L30-L34

      https://github.com/mesosphere/marathon/blob/master/src/main/scala/mesosphere/marathon/state/Timestamp.scala#L18

      https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html#toString--

      Has this:

      
      public String toString()
      Outputs this date-time as a String, such as 2007-12-03T10:15:30+01:00.
      The output will be one of the following ISO-8601 formats:
       
      uuuu-MM-dd'T'HH:mmXXXXX
      uuuu-MM-dd'T'HH:mm:ssXXXXX
      uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX
      uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX
      uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX
      The format used will be the shortest that outputs the full value of the time where the omitted parts are implied to be zero.
      

      This can cause bugs when the timestamps are "perfect" because they lack the milliseconds that they have 999/1000 times.

      Specifically in the python library Yelp uses, the timestamp format is assumed here:

      https://github.com/thefactory/marathon-python/blob/b2b41d2afdd24522e828f5e32a43d857dee0026c/marathon/models/task.py#L26

      So it is arguably a bug in that library. Can you confirm: should we expect milliseconds in the timestamp outputs for datetime from Marathon?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                solarkennedy Kyle Anderson
                Team:
                Orchestration Team
                Watchers:
                EvanKrall, Harpreet Gulati, Kyle Anderson
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: