-
Notifications
You must be signed in to change notification settings - Fork 20
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 job status endpoint to server #263
Conversation
@val500 @plars please consider documentation in all implementation changes: if it's the case that documentation is missing on the topic affected altogether, consider it a part of the scope to address that too (so we amortise that implementation cost across PRs as opposed to expect some future documentation catch-up). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main concern is reliability, as in I wonder if we should add this to a queue rather than forward immediately
3db4ff7
to
570769d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're missing the enums.py at the very least. Can you add that here or tell me where to find it if it's external?
570769d
to
71cd870
Compare
13d8725
to
3499736
Compare
3499736
to
00e7ce1
Compare
343ea2a
to
ebd5f7c
Compare
ebd5f7c
to
f22ca7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did have a few comments left, but to avoid blocking anything I'll approve. As I think this is a good first step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few more comments below. I think it would be nice to add a bit more on the unit tests, especially on the possible error/failure conditions. And I would definitely recommend and end-to-end test of this now that you have the test-observer side prototyped.
It occurred to me that it would be useful for TO if TF informs it about the last event. As in TF can mark an event as Update:
|
@omar-selo I think every job will end with the cleanup phase regardless of whether the job was cancelled or something threw an error, so the last event will always be ended_cleanup - @plars can confirm |
That's true for testflinger specifically, but the idea is to make it more generic on both sides. We could set something like a boolean "IsFinal" but for us, it would always be on that cleanup event because that's the last thing that would happen, regardless of whether any part of the job failed. However, that means that something like an event showing that the job timed out, cancelled, etc... would have already happened. If this is what you are really interested in, then perhaps we should mark those with an "IsTerminal" event for event types that will wind up terminating the whole job? would that be enough for you to pick those out as the reason for the overall job termination? |
07bd454
to
b5e77c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! we should definitely go ahead and implement the things agreed to on the card unless you have further input on it. A few more comments, but looking better :)
b5e77c9
to
7500809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meeting notes: need resource_url
added - we discussed adding a JOB_START event at the beginning like the JOB_END event we have at the end. The detail section for that JOB_START event can contain the resource_url
which would just be https://testflinger.canonical.com/jobs/<JOB_ID>
. That isn't going to change throughout the job, so there's no need to send it with every single event.
7500809
to
c744181
Compare
c744181
to
b074c27
Compare
371a33b
to
8a469fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it should be good, and thanks for the video showing your testing of it against the TO changes on the other PR.
As discussed yesterday, please wait until the TO changes land so that we can land these PRs at the same time, and test them in staging together.
Description
This adds an endpoint to Testflinger server that receives status updates from Testflinger agents. These updates require a webhook that the server will forward the rest of the update message to.
Documentation
Documentation was added to job_schema.rst to reflect new job_status_webhook option in the job yaml. The server ReadMe was updated with details on the new status endpoint.
Web service API changes
Interface: [POST] /v1/status
Request Structure:
Response Status Codes:
Rationale: This endpoint receives status updates from the agent if there is a webhook specified in the job yaml and posts the update to this webhook.
Tests
For the server, unit tests were added to test_v1.py. For the agents, unit tests were added to both test_client.py and test_agent.py to test both webhook posting behavior and overall status updating.