Skip to content

Missing default deadlines in generated stubs #1477

Closed
@igorbernstein2

Description

@igorbernstein2

Code example

from google.cloud.bigtable_admin_v2 import BigtableTableAdminClient
from google.cloud.bigtable_admin_v2.types import ModifyColumnFamiliesRequest, ColumnFamily,GcRule

c = BigtableTableAdminClient()
c.modify_column_families(
    ModifyColumnFamiliesRequest(
        name="projects/my-project/instances/my-instance/tables/my-table",
        modifications=[
            ModifyColumnFamiliesRequest.Modification(
                id="family",
                create=ColumnFamily(
                    gc_rule=GcRule(
                        max_num_versions=1
                    )
                )
            )
        ]
    )
)

This should send the RPC using the default deadline configured here in service json file, which generates the defaults base.py:
https://github.com/googleapis/python-bigtable/blob/0841824c7b9539df2530370ea128c140eda0f2b2/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py#L199-L203

However this deadline is not respected. I believe the problem comes from the generator using None as the default in the stub:

https://github.com/googleapis/python-bigtable/blob/0841824c7b9539df2530370ea128c140eda0f2b2/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py#L1229

Which will end up being pushed down into determine_timeout:
https://github.com/googleapis/python-api-core/blob/ddcc2499fa756f98268eb552edba6f25ddbe0c26/google/api_core/gapic_v1/method.py#L63-L101

Which seems to treat None to mean no deadline and wants Method.DEFAULT to mean the default deadline

Specifically this:

   if specified_timeout is DEFAULT:
        specified_timeout = default_timeout

This effectively means that gapic generated clients will never send a default deadline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions