influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.08k stars 3.56k forks source link

InfluxDB 2.0: The "beforeTime" for filtering runs to those scheduled before this time doesn't works [area/api] #13577

Open bednar opened 5 years ago

bednar commented 5 years ago

The /tasks/{taskID}/runs is defined as:

'/tasks/{taskID}/runs':
    get:
      tags:
        - Tasks
      summary: Retrieve list of run records for a task
      parameters:
        - $ref: '#/components/parameters/TraceSpan'
        - in: path
          name: taskID
          schema:
            type: string
          required: true
          description: ID of task to get runs for
        - in: query
          name: after
          schema:
            type: string
          description: returns runs after specified ID
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: the number of runs to return
        - in: query
          name: afterTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled after this time, RFC3339
        - in: query
          name: beforeTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled before this time, RFC3339
      responses:
        '200':
          description: a list of task runs
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Runs"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

but even If I specify the beforeTime the result contains Runs from future:

-> GET 
-> http://127.0.0.1:9999/api/v2/tasks/03be546b47bf2000/runs?beforeTime=2019-04-22T08%3A33%3A41.629Z

<- 200
<- OK
<- {
    "links": {
        "self": "/api/v2/tasks/03be546b47bf2000/runs",
        "task": "/api/v2/tasks/03be546b47bf2000"
    },
    "runs": [{
        "links": {
            "logs": "/api/v2/tasks/03be546b47bf2000/runs/03be546bc33f2000/logs",
            "retry": "/api/v2/tasks/03be546b47bf2000/runs/03be546bc33f2000/retry",
            "self": "/api/v2/tasks/03be546b47bf2000/runs/03be546bc33f2000",
            "task": "/api/v2/tasks/03be546b47bf2000"
        },
        "id": "03be546bc33f2000",
        "taskID": "03be546b47bf2000",
        "status": "success",
        "scheduledFor": "2019-04-23T08:33:42Z",
        "startedAt": "2019-04-23T08:33:42.175365406Z",
        "finishedAt": "2019-04-23T08:33:42.231212953Z",
        "log": [{
            "time": "2019-04-23T08:33:42.157689383Z",
            "message": "Started task from script: \"option task = {name: \\\"it task1556008421630-IT\\\", every: 1s} \\n from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0) |\u003e last()\""
        }, {
            "time": "2019-04-23T08:33:42.210091685Z",
            "message": "{\"total_duration\":9618755,\"compile_duration\":1934,\"queue_duration\":45788,\"plan_duration\":0,\"requeue_duration\":0,\"execute_duration\":9554126,\"concurrency\":0,\"max_allocated\":0,\"metadata\":{\"influxdb/scanned-bytes\":[0],\"influxdb/scanned-values\":[0]}}"
        }, {
            "time": "2019-04-23T08:33:42.220417708Z",
            "message": "Completed successfully"
        }]
    }, {
        "links": {
            "logs": "/api/v2/tasks/03be546b47bf2000/runs/03be546cc0bf2000/logs",
            "retry": "/api/v2/tasks/03be546b47bf2000/runs/03be546cc0bf2000/retry",
            "self": "/api/v2/tasks/03be546b47bf2000/runs/03be546cc0bf2000",
            "task": "/api/v2/tasks/03be546b47bf2000"
        },
        "id": "03be546cc0bf2000",
        "taskID": "03be546b47bf2000",
        "status": "success",
        "scheduledFor": "2019-04-23T08:33:43Z",
        "startedAt": "2019-04-23T08:33:43.188203286Z",
        "finishedAt": "2019-04-23T08:33:43.260272305Z",
        "log": [{
            "time": "2019-04-23T08:33:43.172512105Z",
            "message": "Started task from script: \"option task = {name: \\\"it task1556008421630-IT\\\", every: 1s} \\n from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0) |\u003e last()\""
        }, {
            "time": "2019-04-23T08:33:43.219653458Z",
            "message": "{\"total_duration\":20222384,\"compile_duration\":2033,\"queue_duration\":29911,\"plan_duration\":0,\"requeue_duration\":0,\"execute_duration\":20169786,\"concurrency\":0,\"max_allocated\":0,\"metadata\":{\"influxdb/scanned-bytes\":[0],\"influxdb/scanned-values\":[0]}}"
        }, {
            "time": "2019-04-23T08:33:43.229824294Z",
            "message": "Completed successfully"
        }]
    }, {
        "links": {
            "logs": "/api/v2/tasks/03be546b47bf2000/runs/03be546db2ff2000/logs",
            "retry": "/api/v2/tasks/03be546b47bf2000/runs/03be546db2ff2000/retry",
            "self": "/api/v2/tasks/03be546b47bf2000/runs/03be546db2ff2000",
            "task": "/api/v2/tasks/03be546b47bf2000"
        },
        "id": "03be546db2ff2000",
        "taskID": "03be546b47bf2000",
        "status": "success",
        "scheduledFor": "2019-04-23T08:33:44Z",
        "startedAt": "2019-04-23T08:33:44.150979514Z",
        "finishedAt": "2019-04-23T08:33:44.218828723Z",
        "log": [{
            "time": "2019-04-23T08:33:44.140647441Z",
            "message": "Started task from script: \"option task = {name: \\\"it task1556008421630-IT\\\", every: 1s} \\n from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0) |\u003e last()\""
        }, {
            "time": "2019-04-23T08:33:44.19819544Z",
            "message": "{\"total_duration\":30167656,\"compile_duration\":2421,\"queue_duration\":764879,\"plan_duration\":0,\"requeue_duration\":0,\"execute_duration\":29378900,\"concurrency\":0,\"max_allocated\":0,\"metadata\":{\"influxdb/scanned-bytes\":[0],\"influxdb/scanned-values\":[0]}}"
        }, {
            "time": "2019-04-23T08:33:44.206811616Z",
            "message": "Completed successfully"
        }]
    }, {
        "links": {
            "logs": "/api/v2/tasks/03be546b47bf2000/runs/03be546ed53f2000/logs",
            "retry": "/api/v2/tasks/03be546b47bf2000/runs/03be546ed53f2000/retry",
            "self": "/api/v2/tasks/03be546b47bf2000/runs/03be546ed53f2000",
            "task": "/api/v2/tasks/03be546b47bf2000"
        },
        "id": "03be546ed53f2000",
        "taskID": "03be546b47bf2000",
        "status": "success",
        "scheduledFor": "2019-04-23T08:33:45Z",
        "startedAt": "2019-04-23T08:33:45.333861026Z",
        "finishedAt": "2019-04-23T08:33:45.375377284Z",
        "log": [{
            "time": "2019-04-23T08:33:45.302037656Z",
            "message": "Started task from script: \"option task = {name: \\\"it task1556008421630-IT\\\", every: 1s} \\n from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0) |\u003e last()\""
        }, {
            "time": "2019-04-23T08:33:45.356717471Z",
            "message": "{\"total_duration\":9676719,\"compile_duration\":1941,\"queue_duration\":72577,\"plan_duration\":0,\"requeue_duration\":0,\"execute_duration\":9584063,\"concurrency\":0,\"max_allocated\":0,\"metadata\":{\"influxdb/scanned-bytes\":[0],\"influxdb/scanned-values\":[0]}}"
        }, {
            "time": "2019-04-23T08:33:45.365948938Z",
            "message": "Completed successfully"
        }]
    }, {
        "links": {
            "logs": "/api/v2/tasks/03be546b47bf2000/runs/03be546fb6bf2000/logs",
            "retry": "/api/v2/tasks/03be546b47bf2000/runs/03be546fb6bf2000/retry",
            "self": "/api/v2/tasks/03be546b47bf2000/runs/03be546fb6bf2000",
            "task": "/api/v2/tasks/03be546b47bf2000"
        },
        "id": "03be546fb6bf2000",
        "taskID": "03be546b47bf2000",
        "status": "success",
        "scheduledFor": "2019-04-23T08:33:46Z",
        "startedAt": "2019-04-23T08:33:46.217746274Z",
        "finishedAt": "2019-04-23T08:33:46.285420547Z",
        "log": [{
            "time": "2019-04-23T08:33:46.204317964Z",
            "message": "Started task from script: \"option task = {name: \\\"it task1556008421630-IT\\\", every: 1s} \\n from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0) |\u003e last()\""
        }, {
            "time": "2019-04-23T08:33:46.263538827Z",
            "message": "{\"total_duration\":35674928,\"compile_duration\":2012,\"queue_duration\":51129,\"plan_duration\":0,\"requeue_duration\":0,\"execute_duration\":35602705,\"concurrency\":0,\"max_allocated\":0,\"metadata\":{\"influxdb/scanned-bytes\":[0],\"influxdb/scanned-values\":[0]}}"
        }, {
            "time": "2019-04-23T08:33:46.274075399Z",
            "message": "Completed successfully"
        }]
    }]
}
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

bednar commented 5 years ago

+1

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

vlastahajek commented 4 years ago

+1