Uh oh!
There was an error while loading. Please reload this page.
Set gapic limits for retries - #1030
Conversation
Codecov Report
@@ Coverage Diff @@## master #1030 +/- ##
==========================================
+ Coverage 94.62% 94.62% +<.01%
==========================================
Files 183 183 Lines 8002 8005 +3 ==========================================
+ Hits 7572 7575 +3
Misses 430 430
Continue to review full report at Codecov.
|
| // AUTOGENERATED BY tools/generate_rpc_policy_defaults.py; DO NOT | ||
| // EDIT MANUALLY. ALL MANUAL CHANGES WILL BE OVERWRITTEN. | ||
| // | ||
| // Copyright 2018 Google Inc. |
| import sys | ||
| import urllib | ||
| FILE_HEADER = """ |
There was a problem hiding this comment.
We probably want all of this in a static file, take a look at:
All the code that does not need to be generated is in a normal file, which includes the generated code:
Could you do that here to make the generator (and the generated code) smaller?
| inline namespace BIGTABLE_CLIENT_NS { | ||
| namespace internal { | ||
| struct RPCPolicyDefaults { |
There was a problem hiding this comment.
I think this class represents the RPCPolicyParameters, they are not the defaults because we no longer have defaults for the policy (we have default policy parameters for each class).
There was a problem hiding this comment.
renamed to RPCPolicyParameters.
| std::chrono::milliseconds(60000) | ||
| #endif // BIGTABLETABLEADMIN_DEFAULT_MAXIMUM_DELAY | ||
| const struct RPCPolicyDefaults kBigtableTableAdminLimits = { |
There was a problem hiding this comment.
If my suggestion above makes sense, this would become:
RPCPolicyParameters constkBigtableTableAdminDefaults{| std::chrono::milliseconds(60000) | ||
| #endif // BIGTABLETABLEADMIN_DEFAULT_MAXIMUM_DELAY | ||
| const struct RPCPolicyDefaults kBigtableTableAdminLimits = { |
There was a problem hiding this comment.
Why do you need an explicit struct here?
coryan
left a comment
There was a problem hiding this comment.
A lot of formatting nits but otherwise looks good.
| // AUTOGENERATED BY tools/generate_rpc_policy_parameters.py; DO NOT EDIT | ||
| // MANUALLY. ALL MANUAL CHANGES WILL BE OVERWRITTEN. | ||
| // | ||
| // Copyright 2017 Google LLC |
| #include "google/cloud/bigtable/internal/rpc_policy_parameters.h" | ||
| #include "google/cloud/bigtable/version.h" | ||
| #include "google/cloud/internal/retry_policy.h" | ||
There was a problem hiding this comment.
blank line removed.
| // AUTOGENERATED BY tools/generate_rpc_policy_parameters.py; DO NOT EDIT MANUALLY. | ||
| // ALL MANUAL CHANGES WILL BE OVERWRITTEN. | ||
| // | ||
| // Copyright 2017 Google LLC |
| // the application developers to change the defaults for their | ||
| // application by compiling with different values. | ||
| #ifndef BIGTABLEINSTANCEADMIN_DEFAULT_INITIAL_DELAY |
There was a problem hiding this comment.
I think these macros should be prefixed by GOOGLE_CLOUD_CPP_, they get very long, but that seems safer.
| BIGTABLE_DEFAULT_INITIAL_DELAY, | ||
| BIGTABLE_DEFAULT_MAXIMUM_RETRY_PERIOD, | ||
| BIGTABLE_DEFAULT_MAXIMUM_DELAY, | ||
| }; |
There was a problem hiding this comment.
Consider adding a#undef for each one of the macros at the end of this file. Once used to define the C++ constants they are no longer needed and we should avoid polluting the application namespace with macros.
There was a problem hiding this comment.
#undef added at the end of file.
| """ Generate header file for retry policy defaults from GAPIC yamls | ||
| GAPIC suggests default values for clients to design their retry policy. |
There was a problem hiding this comment.
Maybe:
GAPIC defines default values for the retry policies in the client library.
| For Bigtable data APIs it is defined in bigtable_gapic.yaml | ||
| https://raw.githubusercontent.com/googleapis/googleapis/master/google/bigtable/v2/bigtable_gapic.yaml | ||
| This script reads both yamls and generates a C++ header file that define |
| https://raw.githubusercontent.com/googleapis/googleapis/master/google/bigtable/v2/bigtable_gapic.yaml | ||
| This script reads both yamls and generates a C++ header file that define | ||
| constants which is used in retry and backoff policies for Bigtable Clients. |
There was a problem hiding this comment.
s/Bigtable Clients/Cloud Bigtable C++ Client Library/
| print prefix + constant + "," | ||
| print "};" | ||
| def print_test(t): |
There was a problem hiding this comment.
I think the Python style guide(s) requires two blank lines before a function or class definition. You could use yapf to reformat this file.
There was a problem hiding this comment.
used yapf to format python script.
| def print_defines(interface): | ||
| prefix = interface['name'].upper().rsplit('.',1)[1] | ||
| struct = interface['name'].rsplit('.',1)[1] | ||
| constants = {"_DEFAULT_INITIAL_DELAY":"initial_retry_delay_millis", |
There was a problem hiding this comment.
I think the python style guide(s) require a space after the :, but yapf will fix this for you as suggested below.
There was a problem hiding this comment.
used yapf to format python script.
manish-qlogic
commented
Aug 26, 2018
How to include generated file in the build, builds with TEST_INSTALL=yes are failing as build is unable to locate Inclusion of |
coryan
commented
Aug 26, 2018
@manish-qlogic I think you need to change You also need change install(DIRECTORY . DESTINATION include/google/cloud/bigtable
FILES_MATCHINGPATTERN"*.inc"FILES_MATCHINGPATTERN"*.h"PATTERN"testing/*"
EXCLUDE)Check the documentation because I am not sure of the syntax. |
manish-qlogic
commented
Aug 27, 2018
PTAL |
coryan
commented
Aug 27, 2018
Can you do a rebase to master one more time? I would like to verify the examples run correctly with your changes (they should, but still would like to check). |
b82e01f to
0fa2ddbComparemanish-qlogic
commented
Aug 27, 2018
Rebased it, PTAL |
This fixes#428 .
This change is