Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Location header to job run creation #699

Closed
nkijak opened this issue Jan 11, 2020 · 4 comments
Closed

Add Location header to job run creation #699

nkijak opened this issue Jan 11, 2020 · 4 comments
Labels

Comments

@nkijak
Copy link
Contributor

nkijak commented Jan 11, 2020

To use the job run API you must first create a run to generate the ID to use. This ID is included in the returned content, but it would be helpful to include a Location header with the full URL to the run resource given that the runs API is quite different from the creation or other APIs.

Currently

$ http -v localhost:5000/api/v1/namespaces/dataeng/jobs/edw-pull/runs < fake_run.json
POST /api/v1/namespaces/dataeng/jobs/edw-pull/runs HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 109
Content-Type: application/json
Host: localhost:5000
User-Agent: HTTPie/1.0.3

{
    "runArgs": {
        "end": "2020-01-02T00:00:00",
        "env": "dev",
        "start": "2020-01-02T00:00:00"
    }
}

HTTP/1.1 201 Created
Content-Length: 271
Content-Type: application/json
Date: Sat, 11 Jan 2020 19:34:52 GMT

{
    "createdAt": "2020-01-11T19:34:52.432Z",
    "nominalEndTime": null,
    "nominalStartTime": null,
    "runArgs": {
        "end": "2020-01-02T00:00:00",
        "env": "dev",
        "start": "2020-01-02T00:00:00"
    },
    "runId": "261202b3-8fd7-42dc-8446-9575f39e2dc1",
    "runState": "NEW",
    "updatedAt": "2020-01-11T19:34:52.437Z"
}

Requested response
Note Location header

HTTP/1.1 201 Created
Content-Length: 271
Content-Type: application/json
Location: localhost:5000/api/v1/jobs/runs/261202b3-8fd7-42dc-8446-9575f39e2dc1
Date: Sat, 11 Jan 2020 19:34:52 GMT

{
    "createdAt": "2020-01-11T19:34:52.432Z",
    "nominalEndTime": null,
    "nominalStartTime": null,
    "runArgs": {
        "end": "2020-01-02T00:00:00",
        "env": "dev",
        "start": "2020-01-02T00:00:00"
    },
    "runId": "261202b3-8fd7-42dc-8446-9575f39e2dc1",
    "runState": "NEW",
    "updatedAt": "2020-01-11T19:34:52.437Z"
}
@wslulciuc
Copy link
Member

wslulciuc commented Jan 11, 2020

@nkijak Agreed! Would you like to add this feature? Here's a link to a great example on how we might initialize the Location header returned by JobResource.createRun(): Example ex10_2: Link Headers

@nkijak
Copy link
Contributor Author

nkijak commented Jan 13, 2020

@wslulciuc Yep. Happy to take this one on.

@wslulciuc
Copy link
Member

@nkijak Thanks! For pointers on how to get started, checkout CONTRIBUTING.md.

nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
Fix for MarquezProject#699

Signed-off-by: Nicolas Kijak <nkijak@gmail.com>
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 14, 2020
Fix for MarquezProject#699

Signed-off-by: Nicolas Kijak <nick.kijak@pngaming.com>
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 15, 2020
Fix for MarquezProject#699

Signed-off-by: Nicolas Kijak <nick.kijak@pngaming.com>
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 16, 2020
Fix for MarquezProject#699

Signed-off-by: Nicolas Kijak <nick.kijak@pngaming.com>
nkijak pushed a commit to nkijak/marquez that referenced this issue Jan 16, 2020
Fix for MarquezProject#699

Signed-off-by: Nicolas Kijak <nick.kijak@pngaming.com>
wslulciuc pushed a commit that referenced this issue Jan 16, 2020
Fix for #699

Signed-off-by: Nicolas Kijak <nick.kijak@pngaming.com>
@wslulciuc
Copy link
Member

Fixed #701. Thanks @nkijak for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants