cli icon indicating copy to clipboard operation
cli copied to clipboard

Application.RunningInstances returns non-"running" instances

Open bobbyhubbard opened this issue 9 years ago • 3 comments

Question related to the cf cli Go API. I'm attempting to check the state of the application and verify that ALL instances are actually RUNNING before I proceed. The api seems to be returning both "starting" and "running" in Application.RunningInstances. Why does it include non-running instance states?

Am I using this correctly? Is there a better way to determine that all instances are in fact running?

Eg

func (cmd *Foo) getAppStatus(cliConnection plugin.CliConnection, appName string) (*AppStatus, error) {
	app, err := cliConnection.GetApp(name)
	...
        # Return ONLY the "running" instances.
        runningInstances := app.RunningInstances 
        ...

What you expected to occur

I expected 'RunningInstances' to just be running...not starting and running.

CLI Version

6.18x - v6.32.0-187-g8e93073e8

CC API Endpoint Version

2.75.0

Platform & Shell Details

Ubuntu 14.04.3 64-bit with gnome-terminal

Any other relevant information

I'm working to understand why the scaleover cli plugin will stop instances on the previous app even though the new app instances arent actually up and running yet. The code indicates they are looking at RunningInstances. Should this be RunningOrStartedInstances? https://github.com/krujos/scaleover-plugin/blob/master/scaleover_plugin.go#L213

bobbyhubbard avatar Nov 15 '17 15:11 bobbyhubbard

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/152887205

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Nov 15 '17 15:11 cf-gitbot

@bobbyhubbard Hi Bobby. The RunningInstances value comes from a running_instances field that is returned by CC after calling the /v2/apps/<app_guid>/summary endpoint. You can see the API endpoint here: http://apidocs.cloudfoundry.org/272/apps/get_app_summary.html. I would follow up with the Cloudfoundry CAPI team to find out what their intended use case of this value is. One way to reach them is via slack at the following url: https://cloudfoundry.slack.com/messages/C07C04W4Q/team/U6WBMK9QW/

n4wei avatar Nov 16 '17 22:11 n4wei

Closing - I believe the question has been answered (at least to the extend the CLI team can).

dkoper avatar Nov 27 '17 01:11 dkoper