Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 20, 2018. It is now read-only.

Conversation

@jmuk
Copy link
Contributor

@jmuk jmuk commented May 13, 2016

Based on the discussion of #95 and googleapis/gapic-generator#70 --
this changes the interface of construct_settings a bit.

The new interface does not have the override parameters for
retrying and bundling anymore. Instead, it has a single
config_override that has the same strucure as client_config has.

API users can specify a copy of default config data with a few
modifications, but if the user-supplied config does not specify
some data, this will fall back to the default config, so
users can safely supply a part of the client config, just for
their edits.

Based on the discussion of googleapis#95 and googleapis/gapic-generator#70 --
this changes the interface of construct_settings a bit.

The new interface does not have the override parameters for
retrying and bundling anymore. Instead, it has a single
config_override that has the same strucure as client_config has.

API users can specify a copy of default config data with a few
modifications, but if the user-supplied config does not specify
some data, this will fall back to the default config, so
users can safely supply a part of the client config, just for
their edits.
@tbetbetbe
Copy link
Contributor

LGTM

  • please address the build failures; disabling the warning for the complexity method should be fine
  • if there are not tracking issues for this change in the gax-php,gax-ruby and gax-nodejs repos let's add them to ensure this element of the surface stays consistent in these languages

This needs to split override_config into a few functions due to
code complexity warning by PEP8.
@jmuk
Copy link
Contributor Author

jmuk commented May 16, 2016

Fixed the errors -- and also filed issues on php and nodejs (gax-ruby already has an issue googleapis/gax-ruby#5).

@tbetbetbe
Copy link
Contributor

LGTM

if not overrides:
return config_base
new_config = copy.deepcopy(config_base)
if 'retry_codes' in overrides:
Copy link
Contributor

@geigerj geigerj May 17, 2016

Choose a reason for hiding this comment

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

Just a thought -- is this really the behavior we want if a user redefines a retry_code or retry_params? For example, in Pubsub, there is a "messages" retry_params. Isn't it confusing if I define a new "messages" retry parameter set without realizing that there's already one with that name, and then accidentally override a bunch of method settings?

What if we raise an exception in this case and say that the name is reserved? Or even better, ensure that a user-provided parameter name is handled distinctly from a default parameter of the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is what we want.

Here, we want to allow users to provide a copy (with edits) of JSON config. Users can copy the JSON file, modify it as they want, and then pass it as a parameter. This is why the new override has the exactly same structure as the original config JSON.

That means, anything specified by the users has to supersede the default config. Otherwise, some of edits in the config will be silently ignored and the default values are used -- that's a more surprising behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chatted offline and I agreed @geigerj -- the modification for the retry params will affect the overrides, but not the original ones.

Based on the discussion, now overriding config can override
the specified methods only, and does not merge the configurations
between the default ones and the user-provided ones.
@codecov-io
Copy link

codecov-io commented May 17, 2016

Current coverage is 97.17%

Merging #103 into master will increase coverage by 0.07%

@@             master       #103   diff @@
==========================================
  Files             8          8          
  Lines           573        600    +27   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            556        583    +27   
  Misses           17         17          
  Partials          0          0          

Powered by Codecov. Last updated by e1279eb...a5d2c79

@jmuk
Copy link
Contributor Author

jmuk commented May 17, 2016

Uploaded a new patch. This (I think) represents our agreements. PTAL -- if it's the right way, I'll update other language PRs as well.

bundle_descriptors, page_descriptors)
for method in overriding_settings:
if method in defaults:
defaults[method] = overriding_settings[method]
Copy link
Contributor

Choose a reason for hiding this comment

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

What about, e.g., overriding timeout but not bundling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed to support that case.



def _merge_retry_options(retry, overrides):
"""Helper fo ``construct_settings()``.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/fo/for

@geigerj
Copy link
Contributor

geigerj commented May 17, 2016

Looks good overall, just some nits

@geigerj
Copy link
Contributor

geigerj commented May 18, 2016

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.