Skip to content
This repository was archived by the owner on Jul 13, 2025. It is now read-only.

Introduce 'call_settings' parameter#70

Merged
jmuk merged 4 commits into
googleapis:masterfrom
jmuk:call_settings
May 19, 2016
Merged

Introduce 'call_settings' parameter#70
jmuk merged 4 commits into
googleapis:masterfrom
jmuk:call_settings

Conversation

@jmuk

@jmuk jmuk commented May 7, 2016

Copy link
Copy Markdown
Contributor

This removes retrying_overrides and bundling_overrides, because
I think it's quite easy to modify the parameters before invoking
the constructor.

This fixes googleapis/gax-python#95 and googleapis/gax-ruby#5

invalid to have a key for a method that is not bundling-enabled. A
value of None indicates that the method in question should not
bundle.
client_config (dict or :class:`google.gax.CallSettings`):

This comment was marked as spam.

@jmuk jmuk force-pushed the call_settings branch from db646ce to 50b3335 Compare May 9, 2016 21:02
@jmuk

jmuk commented May 9, 2016

Copy link
Copy Markdown
Contributor Author

So I think my code had a confusion about the JSON-parsed config vs the return value of construct_settings(), and probably we want to accept the return value of construct_settings rather than other data (like parsed result of JSON config files).

@geigerj

geigerj commented May 9, 2016

Copy link
Copy Markdown
Contributor

I still think that this means that to override any bundling/retry/page streaming behavior, even for a single method, you must provide an overly complex dictionary over every method in the API, and the keys of that dict must include non-configurable information like PageDescriptor.

@jmuk jmuk force-pushed the call_settings branch from 50b3335 to afa2269 Compare May 13, 2016 01:04
@jmuk

jmuk commented May 13, 2016

Copy link
Copy Markdown
Contributor Author

You're right about the bundling descriptors and page descriptors.

I'm still suspicious about retrying_overrides and bundling_overrides though. With this client_config param, users can simply modify the input dict() (or JSON files) directly instead of passing override parameters, and I think we can omit them from the constructor parameters.

@geigerj

geigerj commented May 13, 2016

Copy link
Copy Markdown
Contributor

I agree that we should not have retrying_overrides or bundling_overrides, and should provide a single override parameter instead.

What I am unclear about is the structure of the dictionary being passed in. In my mind, it should

  • be possible to override only some of the methods in an API
  • be possible to override only some of the behaviors (retry, timeout, bundling, ...) of a particular method
  • not be possible to override PageDescriptor or BundleDescriptor

@jmuk

jmuk commented May 13, 2016

Copy link
Copy Markdown
Contributor Author

Hm, I see. So you are saying to allow call_settings specify a part of methods, only for customized ones. Uploaded a new one, which essentially invokes construct_settings() twice so that it can fall back to the default config.

Or, probably fix construct_settings interface? Any ideas?

@geigerj

geigerj commented May 13, 2016

Copy link
Copy Markdown
Contributor

Yes, I think this would require a change to construct_settings to get the "parts of a method" level of granularity in overriding behavior.

I think there's also some more subtlety to the merging part of this setup that needs to be addressed in GAX. (For example, suppose the user defines a new retry_params whose name shadows a name in the default -- do we want the new retry_params to shadow all of the methods which reference the old retry_params name? I suspect in this case we'd only want the overriden method to reference the new retry_params.)

jmuk added a commit to jmuk/gax-python that referenced this pull request May 13, 2016
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.
@jmuk

jmuk commented May 13, 2016

Copy link
Copy Markdown
Contributor Author

Created a change on GAX to address the issue. PTAL.

jmuk added a commit to googleapis/gax-python that referenced this pull request May 18, 2016
* Update construct_settings overrides

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.

* Style fix.

This needs to split override_config into a few functions due to
code complexity warning by PEP8.

* Update the overriding strategy.

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.

* More merges of method configs.

* Fixes
jmuk added 2 commits May 18, 2016 14:25
This removes retrying_overrides and bundling_overrides, because
I think it's quite easy to modify the parameters before invoking
the constructor.

This fixes googleapis/gax-python#95 and googleapis/gax-ruby#5
@geigerj

geigerj commented May 18, 2016

Copy link
Copy Markdown
Contributor

When you have a chance, could you update this to reflect the changes merged into GAX?

@jmuk jmuk force-pushed the call_settings branch from 96636f5 to a18e013 Compare May 18, 2016 21:39
@jmuk

jmuk commented May 18, 2016

Copy link
Copy Markdown
Contributor Author

Updated for the new construct_settings behavior. PTAL

value of None indicates that the method in question should not
bundle.
client_config (dict):
A dictionary for call settings for each method. See

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@geigerj

geigerj commented May 18, 2016

Copy link
Copy Markdown
Contributor

Just an optional comment on updating a doc reference, but I don't want to block on this.

LGTM

@jmuk jmuk merged commit 83369b1 into googleapis:master May 19, 2016
ethanbao pushed a commit to ethanbao/toolkit that referenced this pull request Jul 19, 2016
* Introduce 'call_settings' parameter

This removes retrying_overrides and bundling_overrides, because
I think it's quite easy to modify the parameters before invoking
the constructor.

This fixes googleapis/gax-python#95 and googleapis/gax-ruby#5

* Fall back to the default config

* Fix the new client_config param behavior

* s/call settings/call options/
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.

API objects should accept an optional 'client_config' argument

2 participants