Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Updates to /status API #1404

Closed
wants to merge 1 commit into from
Closed

Updates to /status API #1404

wants to merge 1 commit into from

Conversation

beav
Copy link
Contributor

@beav beav commented Dec 8, 2014

This patch returns additional data from the /status API call. Specifically, it
returns a worker list, the message broker connection status, the database
connection status, and the Pulp version (RHBZ #704184).

There is a small behavior change to include the resource manager and scheduler
as part of the worker heartbeat list. Previously, these were not included in
the list.

@bowlofeggs bowlofeggs self-assigned this Dec 9, 2014
{
"api_version": "2",
"pulp_messaging_connection": true,
"pulp_database_connection": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we ever want to put more information on these, perhaps DB host name or detected version, or whether SSL is being used? If so, it might be good to go ahead and make these JSON objects instead of bools so that we could add to them in a Y release instead of having to wait for an X release to change them. Even if we just make it a JSON object with only the key "connected" set to true/false, I think that's future-safe.

This isn't a blocker, so do what you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I will update the PR for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it now does

    "pulp_db_connection": {
        "connected": true
    },
    "pulp_messaging_connection": {
        "connected": true
    },
    "pulp_version": {
        "platform_version": "2.6.0"
    }

@bowlofeggs
Copy link
Contributor

LGTM bro! Just watch out for that thing about which workers the resource_manager will try to assign work to. It might have just queried that known workers table, so we should make sure it avoids itself and the scheduler.

@asmacdo
Copy link
Contributor

asmacdo commented Dec 10, 2014

@beav, let me know when you merge this. I started a PR bmbouter#3 to match the /status behavior with django.

@beav
Copy link
Contributor Author

beav commented Dec 10, 2014

@asmacdo will do. It will not be until later this week, I need to get in a PR for another BZ first.

@beav
Copy link
Contributor Author

beav commented Dec 11, 2014

@bmbouter noticed an unused ping() method in https://github.com/pulp/pulp/blob/master/bindings/pulp/bindings/server_info.py#L55. I will remove this as well as part of the PR updates.

@beav
Copy link
Contributor Author

beav commented Dec 31, 2014

After consultation with @bmbouter, it turned out to be better to just filter out special workers like the scheduler when we look for free workers.

@beav beav force-pushed the status-api branch 3 times, most recently from 3014a3f to 2893897 Compare January 2, 2015 20:48
@beav
Copy link
Contributor Author

beav commented Jan 2, 2015

@rbarlow I think I got everything. I saw that you LGTM'd but if you don't mind, can you re-review?

I will merge this to 2.6-testing as well when I merge.

@return: Response
"""
path = '/v2/services/status/'
return self.server.GET(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the bindings could be considered part of our API, we shouldn't remove this until 3.0.0. However, we could insert a DeprecationWarning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path this uses is a 404. I think it's better to just remove it; I suspect it has not worked in a long while.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beav you are correct this should just be removed. The webcode handler is there, but it hasn't been wired up in application.py in a long time. There is no way for a web request to reach this code.

@bowlofeggs
Copy link
Contributor

Re-LGTM, except that I think we should deprecate that binding rather than remove it.

This patch returns additional data from the /status API call. Specifically, it
returns a worker list, the message broker connection status, the database
connection status, and the Pulp version (RHBZ #704184).

There is a small behavior change to include the resource manager and scheduler
as part of the worker heartbeat list. Previously, these were not included in
the list. These entries are filtered out when Pulp requests a free worker.

A few PEP8 fixes are included as well for files that were touched in this patch.

Additionally, the `ping()` method in ServerInfoAPI has been removed; this
called a URL that no longer exists.
@beav
Copy link
Contributor Author

beav commented Jan 5, 2015

Closing PR, will re-open a new one against 2.6-testing and merge since this is already LGTM'd.

@beav beav closed this Jan 5, 2015
@beav beav mentioned this pull request Jan 5, 2015
@beav
Copy link
Contributor Author

beav commented Jan 5, 2015

merged in #1478

@beav beav deleted the status-api branch January 5, 2015 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants