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

task_stats bugfix and query improvements. #105

Merged
merged 1 commit into from
Jun 3, 2016
Merged

task_stats bugfix and query improvements. #105

merged 1 commit into from
Jun 3, 2016

Conversation

oilbeater
Copy link
Contributor

Fix task_stats bugs in MarathonApp init that wrongly use version_info.
Add more query parameters to list_apps and get_app to get more info.
Add readiness_check_results to MarathonApp when query embed with app.readiness marathon will return readinessCheckResults field.

@solarkennedy
Copy link
Contributor

I think this looks good. @Rob-Johnson can you give a quick second opinion?

@oilbeater can you address the lint failures?
https://travis-ci.org/thefactory/marathon-python/jobs/133418986#L233
looks like the itests that use this code pass, which is good.

@oilbeater
Copy link
Contributor Author

Fix pep8 issues, is there any way to run test locally, so I can test myself before push code.

@solarkennedy
Copy link
Contributor

In theory you can run "make itests"? But it is a little tricky because you need docker and junk.

@solarkennedy
Copy link
Contributor

@oilbeater
Copy link
Contributor Author

Any feedback on this?

@Rob-Johnson
Copy link
Contributor

hey @oilbeater: It's a public holiday today, but I'll get to this first thing tomorrow morning UTC.


:returns: application
:rtype: :class:`marathon.models.app.MarathonApp`
"""
params = {'embed': 'apps.tasks'} if embed_tasks else {}
params = {}
embed_param = self._parse_embed_params()
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's significantly more verbose, but I'd much prefer you do the following to using inspect:

embed_params = {
      'app.tasks': embed_tasks,
      'app.counts': embed_counts,
      'app.deployments': embed_deployments
      ....
}
filtered_embed_params = { k: v for k,v in embed_params if v }
params['embed'] = filtered_embed_params

Personally I think it makes it more explicit what is 'really' happening here, rather than hiding that complexity in the _parse_embed_params function (and it introspecting the current frame).

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm going to second @Rob-Johnson's request here.

The frame-inspection is pretty magical and it can be avoided, eh I guess we would have to copy-paste one time? (once for get_app and once for list_apps)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed that inspect is magical to achieve less redundant code, otherwise these params code should appear twice in get_app and list_apps. If these two methods are not merged into one, it seems hard to avoid redundancy. If the redundancy is acceptable, I am ok to change the code in this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine @oilbeater

@Rob-Johnson
Copy link
Contributor

I've left a comment, but I'll leave it to @solarkennedy to decide if he wants to block shipping on this. lg2m otherwise, ty for your contributions to this @oilbeater, it's appreciated!

Fix task_stats  bugs in MarathonApp init that wrongly use version_info.
Add more query parameters to list_apps and get_app to get more info.
Add readiness_check_results to MarathonApp when query embed with app.readiness marathon will return readinessCheckResults field.
@Rob-Johnson
Copy link
Contributor

shipit

@solarkennedy solarkennedy merged commit 6680f91 into thefactory:master Jun 3, 2016
@solarkennedy
Copy link
Contributor

Ty @oilbeater!

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

Successfully merging this pull request may close these issues.

3 participants