Giter VIP home page Giter VIP logo

python-iot's Introduction

NOTE:**This github repository is archived. Google Cloud IoT Core is retired as of August 2023. For details, see https://cloud.google.com/iot-core. **

Python Client for Google Cloud Internet of Things (IoT) Core API

stable pypi versions

Google Cloud Internet of Things (IoT) Core API: is a complete set of tools to connect, process, store, and analyze data both at the edge and in the cloud. The platform consists of scalable, fully-managed cloud services; an integrated software stack for edge/on-premises computing with machine learning capabilities for all your IoT needs.

Quick Start

In order to use this library, you first need to go through the following steps:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Google Cloud Internet of Things (IoT) Core API.
  4. Setup Authentication.

Installation

Install this library in a virtual environment using venv. venv is a tool that creates isolated Python environments. These isolated environments can have separate versions of Python packages, which allows you to isolate one project's dependencies from the dependencies of other projects.

With venv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

Code samples and snippets

Code samples and snippets live in the samples/ folder.

Supported Python Versions

Our client libraries are compatible with all current active and maintenance versions of Python.

Python >= 3.7

Unsupported Python Versions

Python <= 3.6

If you are using an end-of-life version of Python, we recommend that you update as soon as possible to an actively supported version.

Mac/Linux
python3 -m venv <your-env>
source <your-env>/bin/activate
pip install google-cloud-iot
Windows
py -m venv <your-env>
.\<your-env>\Scripts\activate
pip install google-cloud-iot

Next Steps

python-iot's People

Contributors

anukaal avatar arithmetic1728 avatar busunkim96 avatar codepriestz avatar crwilcox avatar dandhlee avatar dependabot[bot] avatar dpebot avatar gcf-owl-bot[bot] avatar gcseh avatar google-cloud-policy-bot[bot] avatar munkhuushmgl avatar parthea avatar pravindahal avatar release-please[bot] avatar renovate-bot avatar surferjeffatgoogle avatar suztomo avatar tseaver avatar vam-google avatar ylil93 avatar yoshi-automation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-iot's Issues

The demo `cloudiot_mqtt_example.py` doesn't have associated README file with instructions.

Overview

I am attempting to run the MQTT demo here to send some test data to my Cloud IoT Core project. The documentation for the demo script says the following:

Before you run the sample, you must follow the instructions in the README for this sample.

I would expect the README to contain instructions on the CLI command to run, detailing the arguments to pass in (similar to the IoT Manager sample). However, I could not find any such README. I have had to read the code of the mqtt_device_demo(args) function to determine what arguments I needed to pass in.

Suggested action

Similar to the IoT Manager sample, create the README in the MQTT sample directory with the appropriate docs for the CLI functions along with example usages.

samples.api-client.manager.manager_test: test_create_gateway failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
  id: "test-registry-d1e57d0645a...opic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d645613c8>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
id: "test-registry-d1e57d0645ac..._topic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d643496a0>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d64531248>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.ALREADY_EXISTS
E details = "A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists."
E debug_error_string = "{"created":"@1626167362.748548765","description":"Error received from peer ipv4:74.125.197.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.","grpc_status":6}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d64561438>

def test_create_gateway(test_topic, capsys):
    gateway_id = device_id_template.format("RS256")
    manager.create_registry(
      service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

manager_test.py:496:


manager.py:446: in create_registry
request={"parent": parent, "device_registry": body}
../../../google/cloud/iot_v1/services/device_manager/client.py:447: in create_device_registry
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.ALREADY_EXISTS
details = "A registry with the pa...ns/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.","grpc_status":6}"

???
E google.api_core.exceptions.AlreadyExists: 409 A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.

:3: AlreadyExists

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Please investigate and fix this issue within 5 business days. While it remains broken,
this library cannot be updated with changes to the python-iot API, and the library grows
stale.

See https://github.com/googleapis/synthtool/blob/master/autosynth/TroubleShooting.md
for trouble shooting tips.

Here's the output from running synth.py:

on of repository 'com_google_protoc_java_resource_names_plugin' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:234:1
DEBUG: Rule 'protoc_docs_plugin' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "33b387245455775e0de45869c7355cc5a9e98b396a6fc43b02812a63b75fee20"
DEBUG: Call stack for the definition of repository 'protoc_docs_plugin' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:258:1
DEBUG: Rule 'rules_python' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "48f7e716f4098b85296ad93f5a133baf712968c13fbc2fdf3a6136158fe86eac"
DEBUG: Call stack for the definition of repository 'rules_python' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:42:1
DEBUG: Rule 'gapic_generator_python' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "fe995def6873fcbdc2a8764ef4bce96eb971a9d1950fe9db9be442f3c64fb3b6"
DEBUG: Call stack for the definition of repository 'gapic_generator_python' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:278:1
DEBUG: Rule 'com_googleapis_gapic_generator_go' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c0d0efba86429cee5e52baf838165b0ed7cafae1748d025abec109d25e006628"
DEBUG: Call stack for the definition of repository 'com_googleapis_gapic_generator_go' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:300:1
DEBUG: Rule 'gapic_generator_php' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "3dffc5c34a5f35666843df04b42d6ce1c545b992f9c093a777ec40833b548d86"
DEBUG: Call stack for the definition of repository 'gapic_generator_php' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:364:1
DEBUG: Rule 'gapic_generator_csharp' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "4db430cfb9293e4521ec8e8138f8095faf035d8e752cf332d227710d749939eb"
DEBUG: Call stack for the definition of repository 'gapic_generator_csharp' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:386:1
DEBUG: Rule 'gapic_generator_ruby' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "a14ec475388542f2ea70d16d75579065758acc4b99fdd6d59463d54e1a9e4499"
DEBUG: Call stack for the definition of repository 'gapic_generator_ruby' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:400:1
DEBUG: /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/rules_python/python/pip.bzl:61:5: DEPRECATED: the pip_repositories rule has been replaced with pip_install, please see rules_python 0.1 release notes
DEBUG: Rule 'bazel_skylib' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0"
DEBUG: Call stack for the definition of repository 'bazel_skylib' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:35:1
Analyzing: target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 0 targets configured)
INFO: Call stack for the definition of repository 'zlib' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/com_google_protobuf/protobuf_deps.bzl:19:9
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:57:1
ERROR: /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/upb/bazel/upb_proto_library.bzl:257:29: aspect() got unexpected keyword argument 'incompatible_use_toolchain_transition'
ERROR: Analysis of target '//google/cloud/iot/v1:iot-v1-py' failed; build aborted: error loading package '@com_github_grpc_grpc//': in /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl: Extension file 'bazel/upb_proto_library.bzl' has errors
INFO: Elapsed time: 0.400s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 6 targets configured)
FAILED: Build did NOT complete successfully (2 packages loaded, 6 targets configured)

Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 31, in <module>
    include_protos=True,
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 52, in py_library
    return self._generate_code(service, version, "python", False, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 204, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--max_idle_secs=240', 'build', '//google/cloud/iot/v1:iot-v1-py']' returned non-zero exit status 1.
2021-04-27 02:38:09,277 autosynth [ERROR] > Synthesis failed
2021-04-27 02:38:09,278 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at 943048c chore(revert): revert preventing normalization (#97)
2021-04-27 02:38:09,284 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2021-04-27 02:38:09,291 autosynth [DEBUG] > Running: git clean -fdx
Removing __pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 356, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 191, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 336, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 68, in synthesize_loop
    has_changes = toolbox.synthesize_version_in_new_branch(synthesizer, youngest)
  File "/tmpfs/src/github/synthtool/autosynth/synth_toolbox.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

Cloud IoT Core Python mqtt example waits 60 seconds between messages, inconsistent with the Readme

Environment details

  • OS type and version: Ubuntu 20.10
  • Python version: 3.10
  • pip version: 22.1.2
  • google-cloud-iot version: 2.5.1

Steps to reproduce

  1. Follow steps in the Readme, create and register a device in IoT Core, set up authentication
  2. Run python cloudiot_mqtt_example.py --algorithm="RS256" --cloud_region="us-central1" --device_id="my-device" --private_key_file rsa_private.pem --project_id="my-project-id" --registry_id="my-registry" device_demo python cloudiot_mqtt_example.py --algorithm="RS256" --cloud_region="us-central1" --device_id="hexagon0" --private_key_file rsa_private.pem --project_id="imposing-medium-358202" --registry_id="hexagon-registry" device_demo (but with the actual project, device, and registry names)
  3. The messages publish correctly, but 60 seconds apart instead of one second apart as described in the readme and a comment.

Code example

It looks like this is caused by the nested for loop starting in line 566 of cloudiot_mqtt_example.py . I tried running it with that loop removed and time.sleep(1) in the main loop, and it works as described (approximately one message per second).

Or, if once every 60 seconds is the expected behavior, then the readme and comment in line 565 are wrong.

Stack trace

N/A

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/rules_python/python/pip.bzl:61:5: DEPRECATED: the pip_repositories rule has been replaced with pip_install, please see rules_python 0.1 release notes
Analyzing: target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 0 targets configured)
INFO: Analyzed target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 6 targets configured).
INFO: Found 1 target...
[0 / 4] [Prepa] BazelWorkspaceStatusAction stable-status.txt ... (2 actions, 1 running)
ERROR: /home/kbuilder/.cache/synthtool/googleapis/google/cloud/iot/v1/BUILD.bazel:157:1: //google/cloud/iot/v1:iot_py_gapic: `bazel-out/host/bin/external/com_google_protobuf/protoc --experimental_allow_proto3_optional --plugin=protoc-gen-python_gapic=bazel-out/host/bin/external/gapic_generator_python/gapic_plugin --python_gapic_out=retry-config=google/cloud/iot/v1/cloudiot_grpc_service_config.json:bazel-out/k8-fastbuild/bin/google/cloud/iot/v1/iot_py_gapic.srcjar.zip -Igoogle/cloud/iot/v1/device_manager.proto=google/cloud/iot/v1/device_manager.proto -Igoogle/cloud/iot/v1/resources.proto=google/cloud/iot/v1/resources.proto -Igoogle/api/annotations.proto=google/api/annotations.proto -Igoogle/api/http.proto=google/api/http.proto -Igoogle/protobuf/descriptor.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/descriptor_proto/google/protobuf/descriptor.proto -Igoogle/api/client.proto=google/api/client.proto -Igoogle/api/field_behavior.proto=google/api/field_behavior.proto -Igoogle/api/resource.proto=google/api/resource.proto -Igoogle/iam/v1/iam_policy.proto=google/iam/v1/iam_policy.proto -Igoogle/iam/v1/options.proto=google/iam/v1/options.proto -Igoogle/iam/v1/policy.proto=google/iam/v1/policy.proto -Igoogle/type/expr.proto=google/type/expr.proto -Igoogle/rpc/status.proto=google/rpc/status.proto -Igoogle/protobuf/any.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/any_proto/google/protobuf/any.proto -Igoogle/protobuf/empty.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/empty_proto/google/protobuf/empty.proto -Igoogle/protobuf/field_mask.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/field_mask_proto/google/protobuf/field_mask.proto -Igoogle/protobuf/timestamp.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/timestamp_proto/google/protobuf/timestamp.proto google/cloud/iot/v1/device_manager.proto google/cloud/iot/v1/resources.proto` failed (Exit 1) protoc failed: error executing command bazel-out/host/bin/external/com_google_protobuf/protoc --experimental_allow_proto3_optional '--plugin=protoc-gen-python_gapic=bazel-out/host/bin/external/gapic_generator_python/gapic_plugin' ... (remaining 20 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
google/cloud/iot/v1/device_manager.proto:29:1: warning: Import google/rpc/status.proto is unused.
Traceback (most recent call last):
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/cli/generate_with_pandoc.py", line 3, in <module>
    from gapic.cli import generate
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/cli/generate.py", line 23, in <module>
    from gapic import generator
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/generator/__init__.py", line 21, in <module>
    from .generator import Generator
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/generator/generator.py", line 24, in <module>
    from gapic.samplegen import manifest, samplegen
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/samplegen/__init__.py", line 15, in <module>
    from gapic.samplegen import samplegen
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/samplegen/samplegen.py", line 27, in <module>
    from gapic.schema import wrappers
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/schema/__init__.py", line 23, in <module>
    from gapic.schema.api import API
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/19/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/schema/api.py", line 29, in <module>
    from google.api_core import exceptions  # type: ignore
ModuleNotFoundError: No module named 'google.api_core'
--python_gapic_out: protoc-gen-python_gapic: Plugin failed with status code 1.
Target //google/cloud/iot/v1:iot-v1-py failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.063s, Critical Path: 0.82s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 31, in <module>
    include_protos=True,
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 52, in py_library
    return self._generate_code(service, version, "python", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 197, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--max_idle_secs=240', 'build', '//google/cloud/iot/v1:iot-v1-py']' returned non-zero exit status 1.
2021-01-28 05:43:31,504 autosynth [ERROR] > Synthesis failed
2021-01-28 05:43:31,504 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at 5ea062b chore(deps): update dependency pyjwt to v2.0.1 (#62)
2021-01-28 05:43:31,509 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2021-01-28 05:43:31,514 autosynth [DEBUG] > Running: git clean -fdx
Removing __pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 354, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 189, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 334, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 65, in synthesize_loop
    has_changes = toolbox.synthesize_version_in_new_branch(synthesizer, youngest)
  File "/tmpfs/src/github/synthtool/autosynth/synth_toolbox.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

"Device" can't be pickled

Hello!

It looks like the "Device" class can't be pickled anymore with your latest major release. We'd like to upgrade to v.2+ but our tests that use multiprocessing fail because of this reason.

Environment details

  • OS type and version: local Mac OS 10.15.7, docker python-base:3.8.3-slim-buster
  • Python version: 3.8.3
  • pip version: 20.1.1
  • google-cloud-iot version: 2.0.1

Steps to reproduce

Try to pickle

Code example and resulting stack trace

import pickle
from google.cloud.iot_v1 import Device

device = Device(id="1")
pickled_device = pickle.dumps(device)
print(pickled_device)

Result:

Traceback (most recent call last):
  File "/Users/cmezzavilla/Code/aratrum/.vscode/scratch.py", line 7, in <module>
    pickled_device = pickle.dumps(device)
_pickle.PicklingError: Can't pickle <class 'Device'>: it's not the same object as __main__.Device

Stack trace from test

We have some tests running with multiprocessing, and when trying to upgrade python-iot from 1.0.0 to 2.0.1 they fail like so:

cls = <class 'multiprocessing.reduction.ForkingPickler'>
obj = ('108ed2f80', '__setitem__', ('europe-west1', {'pytest-of-cmezzavilla_aratrum_pytest-1': {'dev_26': id: "dev_26"
name:...pytest-of-cmezzavilla_aratrum_pytest-1/devices/dev_26"
config {
  version: 1
  binary_data: "invalid config"
}
}}), {})
protocol = None

    @classmethod
    def dumps(cls, obj, protocol=None):
        buf = io.BytesIO()
>       cls(buf, protocol).dump(obj)
E       _pickle.PicklingError: Can't pickle <class 'Device'>: attribute lookup Device on __main__ failed

Your .repo-metadata.json file has a problem ๐Ÿค’

You have a problem with your .repo-metadata.json file:

Result of scan ๐Ÿ“ˆ:

  • release_level must be equal to one of the allowed values in .repo-metadata.json
  • api_shortname field missing from .repo-metadata.json

โ˜๏ธ Once you address these problems, you can close this issue.

Need help?

  • Schema definition: lists valid options for each field.
  • API index: for gRPC libraries api_shortname should match the subdomain of an API's hostName.
  • Reach out to go/github-automation if you have any questions.

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

ages loaded
DEBUG: /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/rules_python/python/pip.bzl:61:5: DEPRECATED: the pip_repositories rule has been replaced with pip_install, please see rules_python 0.1 release notes
Analyzing: target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 0 targets configured)
INFO: Analyzed target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 6 targets configured).
INFO: Found 1 target...
[0 / 2] [Prepa] BazelWorkspaceStatusAction stable-status.txt
ERROR: /home/kbuilder/.cache/synthtool/googleapis/google/cloud/iot/v1/BUILD.bazel:157:1: //google/cloud/iot/v1:iot_py_gapic: `bazel-out/host/bin/external/com_google_protobuf/protoc --experimental_allow_proto3_optional --plugin=protoc-gen-python_gapic=bazel-out/host/bin/external/gapic_generator_python/gapic_plugin --python_gapic_out=retry-config=google/cloud/iot/v1/cloudiot_grpc_service_config.json:bazel-out/k8-fastbuild/bin/google/cloud/iot/v1/iot_py_gapic.srcjar.zip -Igoogle/cloud/iot/v1/device_manager.proto=google/cloud/iot/v1/device_manager.proto -Igoogle/cloud/iot/v1/resources.proto=google/cloud/iot/v1/resources.proto -Igoogle/api/annotations.proto=google/api/annotations.proto -Igoogle/api/http.proto=google/api/http.proto -Igoogle/protobuf/descriptor.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/descriptor_proto/google/protobuf/descriptor.proto -Igoogle/api/client.proto=google/api/client.proto -Igoogle/api/field_behavior.proto=google/api/field_behavior.proto -Igoogle/api/resource.proto=google/api/resource.proto -Igoogle/iam/v1/iam_policy.proto=google/iam/v1/iam_policy.proto -Igoogle/iam/v1/options.proto=google/iam/v1/options.proto -Igoogle/iam/v1/policy.proto=google/iam/v1/policy.proto -Igoogle/type/expr.proto=google/type/expr.proto -Igoogle/rpc/status.proto=google/rpc/status.proto -Igoogle/protobuf/any.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/any_proto/google/protobuf/any.proto -Igoogle/protobuf/empty.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/empty_proto/google/protobuf/empty.proto -Igoogle/protobuf/field_mask.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/field_mask_proto/google/protobuf/field_mask.proto -Igoogle/protobuf/timestamp.proto=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/timestamp_proto/google/protobuf/timestamp.proto google/cloud/iot/v1/device_manager.proto google/cloud/iot/v1/resources.proto` failed (Exit 1) protoc failed: error executing command bazel-out/host/bin/external/com_google_protobuf/protoc --experimental_allow_proto3_optional '--plugin=protoc-gen-python_gapic=bazel-out/host/bin/external/gapic_generator_python/gapic_plugin' ... (remaining 20 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
google/cloud/iot/v1/device_manager.proto:29:1: warning: Import google/rpc/status.proto is unused.
Traceback (most recent call last):
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/cli/generate_with_pandoc.py", line 3, in <module>
    from gapic.cli import generate
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/cli/generate.py", line 23, in <module>
    from gapic import generator
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/generator/__init__.py", line 21, in <module>
    from .generator import Generator
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/generator/generator.py", line 24, in <module>
    from gapic.samplegen import manifest, samplegen
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/samplegen/__init__.py", line 15, in <module>
    from gapic.samplegen import samplegen
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/samplegen/samplegen.py", line 27, in <module>
    from gapic.schema import wrappers
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/schema/__init__.py", line 23, in <module>
    from gapic.schema.api import API
  File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/sandbox/linux-sandbox/18/execroot/com_google_googleapis/bazel-out/host/bin/external/gapic_generator_python/gapic_plugin.runfiles/gapic_generator_python/gapic/schema/api.py", line 29, in <module>
    from google.api_core import exceptions  # type: ignore
ModuleNotFoundError: No module named 'google.api_core'
--python_gapic_out: protoc-gen-python_gapic: Plugin failed with status code 1.
Target //google/cloud/iot/v1:iot-v1-py failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.184s, Critical Path: 0.82s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 31, in <module>
    include_protos=True,
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 52, in py_library
    return self._generate_code(service, version, "python", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 193, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--max_idle_secs=240', 'build', '//google/cloud/iot/v1:iot-v1-py']' returned non-zero exit status 1.
2021-01-21 05:43:17,812 autosynth [ERROR] > Synthesis failed
2021-01-21 05:43:17,812 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at d55f5e0 chore(deps): update dependency cryptography to v3.3.1 (#37)
2021-01-21 05:43:17,817 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2021-01-21 05:43:17,822 autosynth [DEBUG] > Running: git clean -fdx
Removing __pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 354, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 189, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 334, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 65, in synthesize_loop
    has_changes = toolbox.synthesize_version_in_new_branch(synthesizer, youngest)
  File "/tmpfs/src/github/synthtool/autosynth/synth_toolbox.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

I can create a device, but cannot grab metadata

Environment details

  • OS type and version: Ubuntu 20.04 on Google VM Instance
  • Python version: 3.8.10
  • pip version: pip --version21.2.4
  • google-cloud-iot version:
    Name: google-cloud-iot
    Version: 2.2.1
    Summary: Cloud IoT API API client library
    Home-page: https://github.com/googleapis/python-iot
    Author: Google LLC
    Author-email: [email protected]
    License: Apache 2.0
    Location: /usr/local/lib/python3.8/dist-packages
    Requires: google-api-core, proto-plus, grpc-google-iam-v1, packaging
    Required-by:

Code example

import io
import os
import sys

from google.cloud import iot_v1
from google.protobuf.field_mask_pb2 import FieldMask
from settings import GCP_PROJECT_ID, GCP_LOCATION, GPC_REG_ID


client = iot_v1.DeviceManagerClient()
registry_path = client.registry_path(GCP_PROJECT_ID, GCP_LOCATION, GPC_REG_ID)


def create_keys(public_key="rsa_public.pem", private_key="rsa_private.pem"):
    os.system(f"openssl genpkey -algorithm RSA -out {private_key} -pkeyopt rsa_keygen_bits:2048")
    os.system(f"openssl rsa -in {private_key} -pubout -out {public_key}")


def create_device(device_id, public_key="rsa_public.pem"):

    with io.open(public_key) as f:
        certificate = f.read()

    # Note: You can have multiple credentials associated with a device.
    device_template = {
        "id": device_id,
        "credentials": [
            {
                "public_key": {
                    "format": iot_v1.PublicKeyFormat.RSA_PEM,
                    "key": certificate,
                }
            }
        ],
    }
    return client.create_device(request={"parent": registry_path, "device": device_template})


def get_device_details():
    field_mask = FieldMask(
        paths=[
            "id",
            "name",
            "num_id",
            "credentials",
            "last_heartbeat_time",
            "last_event_time",
            "last_state_time",
            "last_config_ack_time",
            "last_config_send_time",
            "blocked",
            "last_error_time",
            "last_error_status",
            "config",
            "state",
            "log_level",
            "metadata",
            "gateway_config",
        ]
    )
    devices = list(client.list_devices(request={"parent": registry_path, "field_mask": field_mask}))
    return devices


def get_device_metadata(device_id):
    field_mask = FieldMask(
        paths=[
            "id",
            "name",
            "num_id",
            "credentials",
            "last_heartbeat_time",
            "last_event_time",
            "last_state_time",
            "last_config_ack_time",
            "last_config_send_time",
            "blocked",
            "last_error_time",
            "last_error_status",
            "config",
            "state",
            "log_level",
            "metadata",
            "gateway_config",
        ]
    )

    device = client.get_device(request={"name": device_id, "field_mask": field_mask})

    print("Id : {}".format(device.id))
    print("Name : {}".format(device.name))
    print("Credentials:")

    if device.credentials is not None:
        for credential in device.credentials:
            key_info = credential.public_key
            print("\tcertificate: \n{}".format(key_info.key))
            if key_info.format == 4:
                key_format = "ES256_X509_PEM"
            elif key_info.format == 3:
                key_format = "RSA_PEM"
            elif key_info.format == 2:
                key_format = "ES256_PEM"
            elif key_info.format == 1:
                key_format = "RSA_X509_PEM"
            else:
                key_format = "UNSPECIFIED_PUBLIC_KEY_FORMAT"
            print("\tformat : {}".format(key_format))
            print("\texpiration: {}".format(credential.expiration_time))

    print("Config:")
    print("\tdata: {}".format(device.config.binary_data))
    print("\tversion: {}".format(device.config.version))
    print("\tcloudUpdateTime: {}".format(device.config.cloud_update_time))

    return device


if __name__ == '__main__':

    create_keys(public_key='/tmp/rsa_public.pem', private_key='/tmp/rsa_private.pem')
    d = create_device(device_id='sample_device', public_key='/tmp/rsa_public.pem')
    print(d)
    print(get_device_metadata(device_id='sample_device'))

Stack trace

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/google/api_core/grpc_helpers.py", line 66, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/usr/local/lib/python3.8/dist-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.PERMISSION_DENIED
        details = "The caller does not have permission"
        debug_error_string = "{"created":"@1634803450.729548399","description":"Error received from peer ipv4:209.85.145.95:443","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"The caller does not have permission","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "utils/google_iot.py", line 149, in <module>
    print(get_device_metadata(device_id='sample_device'))
  File "utils/google_iot.py", line 95, in get_device_metadata
    device = client.get_device(request={"name": device_id, "field_mask": field_mask})
  File "/usr/local/lib/python3.8/dist-packages/google/cloud/iot_v1/services/device_manager/client.py", line 898, in get_device
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/usr/local/lib/python3.8/dist-packages/google/api_core/gapic_v1/method.py", line 142, in __call__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/google/api_core/retry.py", line 283, in retry_wrapped_func
    return retry_target(
  File "/usr/local/lib/python3.8/dist-packages/google/api_core/retry.py", line 190, in retry_target
    return target()
  File "/usr/local/lib/python3.8/dist-packages/google/api_core/grpc_helpers.py", line 68, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.PermissionDenied: 403 The caller does not have permission

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

samples.api-client.accesstoken_example.accesstoken_test: test_send_iot_command_to_device failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: 0ca174a
buildURL: Build Status, Sponge
status: failed

Test output
def test_send_iot_command_to_device():
        device_id = device_id_template.format(uuid.uuid4())
        service_account_email = (
            "[email protected]"
        )
        command_to_be_sent_to_device = "OPEN_DOOR"
        manager.open_registry(
            service_account_json, project_id, cloud_region, device_pubsub_topic, registry_id
        )
    manager.create_rs256_device(
        service_account_json,
        project_id,
        cloud_region,
        registry_id,
        device_id,
        rsa_cert_path,
    )
    # Create device MQTT client and connect to cloud iot mqtt bridge.
    mqtt_bridge_hostname = "mqtt.googleapis.com"
    mqtt_bridge_port = 8883
    mqtt_tls_cert = "resources/roots.pem"
    client = cloudiot_mqtt_example.get_client(
        project_id,
        cloud_region,
        registry_id,
        device_id,
        rsa_private_path,
        "RS256",
        mqtt_tls_cert,
        mqtt_bridge_hostname,
        mqtt_bridge_port,
    )
    accesstoken.send_iot_command_to_device(
        cloud_region,
        project_id,
        registry_id,
        device_id,
        "RS256",
        rsa_private_path,
        service_account_email,
      command_to_be_sent_to_device,
    )

accesstoken_test.py:158:


accesstoken.py:353: in send_iot_command_to_device
assert command_resp.ok, command_resp.raise_for_status()


self = <Response [404]>

def raise_for_status(self):
    """Raises :class:`HTTPError`, if one occurred."""

    http_error_msg = ''
    if isinstance(self.reason, bytes):
        # We attempt to decode utf-8 first because some servers
        # choose to localize their reason strings. If the string
        # isn't utf-8, we fall back to iso-8859-1 for all other
        # encodings. (See PR #3538)
        try:
            reason = self.reason.decode('utf-8')
        except UnicodeDecodeError:
            reason = self.reason.decode('iso-8859-1')
    else:
        reason = self.reason

    if 400 <= self.status_code < 500:
        http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)

    elif 500 <= self.status_code < 600:
        http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)

    if http_error_msg:
      raise HTTPError(http_error_msg, response=self)

E requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://cloudiot.googleapis.com/v1/projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-c332037d9aee4e6a92d3b831ff3b26a3-1633079588/devices/test-device-256-0bcc9592-bc28-47b2-bc0f-bbcb267149b3:sendCommandToDevice

.nox/py-3-6/lib/python3.6/site-packages/requests/models.py:953: HTTPError

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

Cloning into 'working_repo'...
Switched to branch 'autosynth'
Running synthtool
['/tmpfs/src/git/autosynth/env/bin/python3', '-m', 'synthtool', 'synth.py', '--']
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py.
On branch autosynth
nothing to commit, working tree clean
HEAD detached at FETCH_HEAD
nothing to commit, working tree clean
synthtool > Ensuring dependencies.
synthtool > Pulling artman image.
latest: Pulling from googleapis/artman
Digest: sha256:6aec9c34db0e4be221cdaf6faba27bdc07cfea846808b3d3b964dfce3a9a0f9b
Status: Image is up to date for googleapis/artman:latest
synthtool > Cloning googleapis.
synthtool > Running generator for google/cloud/iot/artman_cloudiot.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/iot-v1.
synthtool > Copy: /home/kbuilder/.cache/synthtool/googleapis/google/cloud/iot/v1/resources.proto to /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/iot-v1/google/cloud/iot_v1/proto/resources.proto
synthtool > Copy: /home/kbuilder/.cache/synthtool/googleapis/google/cloud/iot/v1/device_manager.proto to /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/iot-v1/google/cloud/iot_v1/proto/device_manager.proto
synthtool > Placed proto files into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/iot-v1/google/cloud/iot_v1/proto.
.coveragerc
.flake8
.github/CONTRIBUTING.md
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/ISSUE_TEMPLATE/support_request.md
.github/PULL_REQUEST_TEMPLATE.md
.github/release-please.yml
.gitignore
.kokoro/build.sh
.kokoro/continuous/common.cfg
.kokoro/continuous/continuous.cfg
.kokoro/docs/common.cfg
.kokoro/docs/docs.cfg
.kokoro/presubmit/common.cfg
.kokoro/presubmit/presubmit.cfg
.kokoro/publish-docs.sh
.kokoro/release.sh
.kokoro/release/common.cfg
.kokoro/release/release.cfg
.kokoro/trampoline.sh
CODE_OF_CONDUCT.md
CONTRIBUTING.rst
LICENSE
MANIFEST.in
docs/_static/custom.css
docs/_templates/layout.html
docs/conf.py.j2
noxfile.py.j2
renovate.json
setup.cfg
Running session blacken
Creating virtual environment (virtualenv) using python3.6 in .nox/blacken
pip install black==19.3b0
Error: pip is not installed into the virtualenv, it is located at /tmpfs/src/git/autosynth/env/bin/pip. Pass external=True into run() to explicitly allow this.
Session blacken failed.
synthtool > Failed executing nox -s blacken:

None
synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/tmpfs/src/git/autosynth/working_repo/synth.py", line 44, in <module>
    s.shell.run(["nox", "-s", "blacken"], hide_output=False)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['nox', '-s', 'blacken']' returned non-zero exit status 1.

Synthesis failed

Google internal developers can see the full log here.

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

rator_python/requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl
  Saved ./Jinja2-2.11.2-py2.py3-none-any.whl
Collecting MarkupSafe==1.1.1 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
  Saved ./MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting protobuf==3.13.0 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 6))
  Using cached https://files.pythonhosted.org/packages/30/79/510974552cebff2ba04038544799450defe75e96ea5f1675dbf72cc8744f/protobuf-3.13.0-cp36-cp36m-manylinux1_x86_64.whl
  Saved ./protobuf-3.13.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting pypandoc==1.5 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 7))
  Using cached https://files.pythonhosted.org/packages/d6/b7/5050dc1769c8a93d3ec7c4bd55be161991c94b8b235f88bf7c764449e708/pypandoc-1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmpfs/tmp/tmprs027c0b/setuptools-tmp/setuptools/__init__.py", line 6, in <module>
        import distutils.core
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/_distutils_hack/__init__.py", line 82, in create_module
        return importlib.import_module('._distutils', 'setuptools')
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named 'setuptools._distutils'
    
    ----------------------------------------
 (Command "python setup.py egg_info" failed with error code 1 in /tmpfs/tmp/pip-build-xt85tj6p/pypandoc/
)
ERROR: no such package '@gapic_generator_python_pip_deps//': pip_import failed: Collecting click==7.1.2 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl
  Saved ./click-7.1.2-py2.py3-none-any.whl
Collecting google-api-core==1.22.1 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/e0/2d/7c6c75013105e1d2b6eaa1bf18a56995be1dbc673c38885aea31136e9918/google_api_core-1.22.1-py2.py3-none-any.whl
  Saved ./google_api_core-1.22.1-py2.py3-none-any.whl
Collecting googleapis-common-protos==1.52.0 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 3))
  Using cached https://files.pythonhosted.org/packages/03/74/3956721ea1eb4bcf7502a311fdaa60b85bd751de4e57d1943afe9b334141/googleapis_common_protos-1.52.0-py2.py3-none-any.whl
  Saved ./googleapis_common_protos-1.52.0-py2.py3-none-any.whl
Collecting jinja2==2.11.2 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl
  Saved ./Jinja2-2.11.2-py2.py3-none-any.whl
Collecting MarkupSafe==1.1.1 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
  Saved ./MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting protobuf==3.13.0 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 6))
  Using cached https://files.pythonhosted.org/packages/30/79/510974552cebff2ba04038544799450defe75e96ea5f1675dbf72cc8744f/protobuf-3.13.0-cp36-cp36m-manylinux1_x86_64.whl
  Saved ./protobuf-3.13.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting pypandoc==1.5 (from -r /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/gapic_generator_python/requirements.txt (line 7))
  Using cached https://files.pythonhosted.org/packages/d6/b7/5050dc1769c8a93d3ec7c4bd55be161991c94b8b235f88bf7c764449e708/pypandoc-1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmpfs/tmp/tmprs027c0b/setuptools-tmp/setuptools/__init__.py", line 6, in <module>
        import distutils.core
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/_distutils_hack/__init__.py", line 82, in create_module
        return importlib.import_module('._distutils', 'setuptools')
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named 'setuptools._distutils'
    
    ----------------------------------------
 (Command "python setup.py egg_info" failed with error code 1 in /tmpfs/tmp/pip-build-xt85tj6p/pypandoc/
)
INFO: Elapsed time: 2.210s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 29, in <module>
    include_protos=True,
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 46, in py_library
    return self._generate_code(service, version, "python", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 183, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--max_idle_secs=240', 'build', '//google/cloud/iot/v1:iot-v1-py']' returned non-zero exit status 1.
2020-08-31 05:19:38,033 autosynth [ERROR] > Synthesis failed
2020-08-31 05:19:38,033 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at 7678eed chore: update Py2 support msg to reflect passage of time (#22)
2020-08-31 05:19:38,038 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2020-08-31 05:19:38,042 autosynth [DEBUG] > Running: git clean -fdx
Removing __pycache__/
Removing google/__pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 690, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 539, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 670, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 375, in synthesize_loop
    has_changes = toolbox.synthesize_version_in_new_branch(synthesizer, youngest)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 273, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

samples.api-client.manager.manager_test: test_add_patch_delete_rs256 failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (device {
  name: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42ceb...  seconds: 1626167359
      nanos: 9140000
    }
  }
  gateway_config {
  }
}
update_mask {
  paths: "credentials"
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'device.name=projects/python-docs-samples-tests/locations/us-central1/registri...c-1626167346/devices/2714760843187157'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d643e7a20>
request = device {
name: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd... seconds: 1626167359
nanos: 9140000
}
}
gateway_config {
}
}
update_mask {
paths: "credentials"
}

timeout = None
metadata = [('x-goog-request-params', 'device.name=projects/python-docs-samples-tests/locations/us-central1/registries/test-regis...cc-1626167346/devices/2714760843187157'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d6445a940>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d64451a88>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAUTHENTICATED
E details = "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
E debug_error_string = "{"created":"@1626167359.446721058","description":"Error received from peer ipv4:74.125.195.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d643e70f0>

def test_add_patch_delete_rs256(test_topic, capsys):
    device_id = device_id_template.format("PATCHME")
    manager.open_registry(
        service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

    manager.create_rs256_device(
        service_account_json,
        project_id,
        cloud_region,
        registry_id,
        device_id,
        rsa_cert_path,
    )

    manager.get_device(
        service_account_json, project_id, cloud_region, registry_id, device_id
    )
    out, _ = capsys.readouterr()
    assert "format : RSA_X509_PEM" in out

    manager.patch_es256_auth(
        service_account_json,
        project_id,
        cloud_region,
        registry_id,
        device_id,
      es_cert_path,
    )

manager_test.py:364:


manager.py:535: in patch_es256_auth
return client.update_device(request={"device": device, "update_mask": mask})
../../../google/cloud/iot_v1/services/device_manager/client.py:980: in update_device
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request had invalid a...entication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"

???
E google.api_core.exceptions.Unauthenticated: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

:3: Unauthenticated

samples.api-client.manager.manager_test: test_add_delete_es256_device failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (name: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346/devices/test-device-ES256"
,)
kwargs = {'metadata': [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us-central1/registries/test...-1626167346/devices/test-device-ES256'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d64684a58>
request = name: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346/devices/test-device-ES256"

timeout = None
metadata = [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e...c-1626167346/devices/test-device-ES256'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d64684860>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d646055c8>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAUTHENTICATED
E details = "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
E debug_error_string = "{"created":"@1626167357.617974126","description":"Error received from peer ipv4:74.125.195.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d656c9080>

def test_add_delete_es256_device(test_topic, capsys):
    device_id = device_id_template.format("ES256")
    manager.open_registry(
        service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

    manager.create_es256_device(
        service_account_json,
        project_id,
        cloud_region,
        registry_id,
        device_id,
        es_cert_path,
    )

    manager.get_device(
        service_account_json, project_id, cloud_region, registry_id, device_id
    )

    manager.get_state(
      service_account_json, project_id, cloud_region, registry_id, device_id
    )

manager_test.py:324:


manager.py:353: in get_state
states = client.list_device_states(request={"name": device_path}).device_states
../../../google/cloud/iot_v1/services/device_manager/client.py:1356: in list_device_states
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:290: in retry_wrapped_func
on_error=on_error,
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:188: in retry_target
return target()
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request had invalid a...entication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"

???
E google.api_core.exceptions.Unauthenticated: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

:3: Unauthenticated

samples.api-client.manager.manager_test: test_list_gateways failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
  id: "test-registry-d1e57d0645a...opic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d642620b8>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
id: "test-registry-d1e57d0645ac..._topic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d64228588>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d641bd048>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAUTHENTICATED
E details = "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
E debug_error_string = "{"created":"@1626167363.148902882","description":"Error received from peer ipv4:74.125.195.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d642627b8>

def test_list_gateways(test_topic, capsys):
    gateway_id = device_id_template.format("RS256")
    manager.create_registry(
      service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

manager_test.py:525:


manager.py:446: in create_registry
request={"parent": parent, "device_registry": body}
../../../google/cloud/iot_v1/services/device_manager/client.py:447: in create_device_registry
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request had invalid a...entication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"

???
E google.api_core.exceptions.Unauthenticated: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

:3: Unauthenticated

samples.api-client.manager.manager_test: test_bind_device_to_gateway_and_unbind failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
  id: "test-registry-d1e57d0645a...opic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d644817f0>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
id: "test-registry-d1e57d0645ac..._topic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d641e8b38>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d641dcf88>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAUTHENTICATED
E details = "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
E debug_error_string = "{"created":"@1626167363.480027800","description":"Error received from peer ipv4:74.125.142.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d64481860>

def test_bind_device_to_gateway_and_unbind(test_topic, capsys):
    gateway_id = device_id_template.format("RS256")
    device_id = device_id_template.format("noauthbind")
    manager.create_registry(
      service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

manager_test.py:557:


manager.py:446: in create_registry
request={"parent": parent, "device_registry": body}
../../../google/cloud/iot_v1/services/device_manager/client.py:447: in create_device_registry
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request had invalid a...entication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"

???
E google.api_core.exceptions.Unauthenticated: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

:3: Unauthenticated

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

ou want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 42ee97c1 chore: revert bigtable-admin to Gapic V1 for Ruby only
2020-06-20 08:20:40,223 autosynth [DEBUG] > Running: git checkout f5e4c17dc78a966dbf29961dd01f9bbd63e20a04
Note: checking out 'f5e4c17dc78a966dbf29961dd01f9bbd63e20a04'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at f5e4c17 feat: Add include_protos parameter support for GAPICBazel (#489)
2020-06-20 08:20:40,239 autosynth [DEBUG] > Running: git branch -f autosynth-self-2
2020-06-20 08:20:40,243 autosynth [DEBUG] > Running: git checkout autosynth-self-2
Switched to branch 'autosynth-self-2'
2020-06-20 08:20:40,247 autosynth [INFO] > Running synthtool
2020-06-20 08:20:40,247 autosynth [INFO] > ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
2020-06-20 08:20:40,247 autosynth [DEBUG] > log_file_path: /tmpfs/src/github/synthtool/logs/googleapis/python-iot/self/2/sponge_log.log
2020-06-20 08:20:40,249 autosynth [DEBUG] > Running: /tmpfs/src/github/synthtool/env/bin/python3 -m synthtool --metadata synth.metadata synth.py --
2020-06-20 08:20:40,466 synthtool [DEBUG] > Executing /home/kbuilder/.cache/synthtool/python-iot/synth.py.
On branch autosynth-self-2
nothing to commit, working tree clean
2020-06-20 08:20:40,605 synthtool [DEBUG] > Ensuring dependencies.
2020-06-20 08:20:40,617 synthtool [DEBUG] > Using precloned repo /home/kbuilder/.cache/synthtool/synthtool
2020-06-20 08:20:40,622 synthtool [DEBUG] > Cloning googleapis.
2020-06-20 08:20:40,622 synthtool [DEBUG] > Using precloned repo /home/kbuilder/.cache/synthtool/googleapis
2020-06-20 08:20:40,626 synthtool [DEBUG] > Generating code for: //google/cloud/iot/v1:iot-v1-py.
2020-06-20 08:20:46,067 synthtool [ERROR] > Failed executing bazel --max_idle_secs=60 build //google/cloud/iot/v1:iot-v1-py:

Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
INFO: SHA256 (https://github.com/googleapis/gapic-generator/archive/4cb5d58f258afdb8abc0b99706370b4a59252b22.zip) = 3cb59685c8a4ae3db1dec60b286f22d8d3aa3d3b36bb08bf003b5e088fac83cb
Loading: 0 packages loaded
DEBUG: Rule 'com_google_api_codegen' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "3cb59685c8a4ae3db1dec60b286f22d8d3aa3d3b36bb08bf003b5e088fac83cb"
DEBUG: Call stack for the definition of repository 'com_google_api_codegen' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:62:1
INFO: SHA256 (https://github.com/googleapis/protoc-java-resource-names-plugin/archive/5bd90a1f67c1c128291702cc320d667060f40f95.zip) = c3c0661b6c30fce5c63b1d5f473b1c6c4d59e19853ce3b9e8f5a447f953af906
DEBUG: Rule 'com_google_protoc_java_resource_names_plugin' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c3c0661b6c30fce5c63b1d5f473b1c6c4d59e19853ce3b9e8f5a447f953af906"
DEBUG: Call stack for the definition of repository 'com_google_protoc_java_resource_names_plugin' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:155:1
INFO: SHA256 (https://github.com/googleapis/gapic-generator-go/archive/v0.13.2.tar.gz) = ab7a2ffd74e6a6dac6da38027d4acadb84d0075c055289e3335d86a46f9f3b22
Loading: 0 packages loaded
DEBUG: Rule 'com_googleapis_gapic_generator_go' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "ab7a2ffd74e6a6dac6da38027d4acadb84d0075c055289e3335d86a46f9f3b22"
DEBUG: Call stack for the definition of repository 'com_googleapis_gapic_generator_go' which is a http_archive (rule definition at /home/kbuilder/.cache/bazel/_bazel_kbuilder/a732f932c2cbeb7e37e1543f189a2a73/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
 - <builtin>
 - /home/kbuilder/.cache/synthtool/googleapis/WORKSPACE:209:1
Analyzing: target //google/cloud/iot/v1:iot-v1-py (1 packages loaded, 0 targets configured)
ERROR: While resolving toolchains for target @pypi_black//:black: invalid registered toolchain '@gapic_generator_python//:pyenv3_toolchain': no such package '@gapic_generator_python//': The repository '@gapic_generator_python' could not be resolved
ERROR: Analysis of target '//google/cloud/iot/v1:iot-v1-py' failed; build aborted: invalid registered toolchain '@gapic_generator_python//:pyenv3_toolchain': no such package '@gapic_generator_python//': The repository '@gapic_generator_python' could not be resolved
INFO: Elapsed time: 5.415s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (20 packages loaded, 14 targets configured)
FAILED: Build did NOT complete successfully (20 packages loaded, 14 targets configured)

2020-06-20 08:20:46,068 synthtool [DEBUG] > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 29, in <module>
    include_protos=True,
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 46, in py_library
    return self._generate_code(service, version, "python", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 180, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--max_idle_secs=60', 'build', '//google/cloud/iot/v1:iot-v1-py']' returned non-zero exit status 1.
2020-06-20 08:20:46,122 autosynth [ERROR] > Synthesis failed
2020-06-20 08:20:46,123 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at bb331f9 chore: Migrate python-iot synth.py from artman to bazel (#13)
2020-06-20 08:20:46,128 autosynth [DEBUG] > Running: git checkout autosynth-self
Switched to branch 'autosynth-self'
2020-06-20 08:20:46,133 autosynth [ERROR] > Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.
2020-06-20 08:20:46,345 autosynth [INFO] > PR already exists: https://github.com/googleapis/python-iot/pull/17
2020-06-20 08:20:46,345 autosynth [DEBUG] > Running: git clean -fdx
Removing __pycache__/
Removing google/__pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 649, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 506, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 629, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 367, in synthesize_loop
    synthesize_inner_loop(fork, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 411, in synthesize_inner_loop
    synthesizer, len(toolbox.versions) - 1
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 266, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

Demo EVENT messages in `cloudiot_mqtt_example.py` are not being sent once every second.

Overview

The comment in the following code block says that that EVENT messages should be sent every second, but STATE messages should be sent with a longer cadence. However, the logic waits the longer period (60 seconds) for all message types.

Code block

https://github.com/googleapis/python-iot/blob/main/samples/api-client/mqtt_example/cloudiot_mqtt_example.py#L475-L478
Currently

        # Send events every second. State should not be updated as often
        for i in range(0, 60):
            time.sleep(1)
            client.loop()

Suggestion

        # Send events every second. State should not be updated as often
        WAIT_IN_SECONDS = 1 if args.message_type == 'event' else 60
        for i in range(0, WAIT_IN_SECONDS):
            time.sleep(1)
            client.loop()

Environment details

  • OS type and version: Raspbian GNU/Linux 10 (buster)
  • Python version: 3.7.3
  • pip version: 21.2.4
  • google-cloud-iot version: 2.2.1

Can't get actual last heartbeat and event time from iot device using python SDK

Hello. I am trying to to get last heartbeat and event time from IOT Device using python sdk. A while ago I noticed that my code stopped working
for device in device_client.list_devices(parent): last_event = device.last_event_time.seconds last_heartbeat = device.last_heartbeat_time.seconds
. I also tried to migrate code to 2.0, but with same results. Value is always 0.
https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices/get#http-request request and gcp console itself, contains correct value for this fields.
Is there an issue with sdk itself?
Thanks in advance

400 The field 'parent' must be in the form 'projects/{project}/locations/{location}'.

I tried a sample code from the documentation and got this error: google.api_core.exceptions.InvalidArgument: 400 The field 'parent' must be in the form 'projects/{project}/locations/{location}'.

My code (from example https://googleapis.dev/python/iot/latest/index.html):

from google.cloud import iot_v1
import os

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'iot-core-test.json'


client = iot_v1.DeviceManagerClient()

parent = client.registry_path('iot-core-test-<id>', 'europe-west1', 'iot-sample-registry')

for page in client.list_device_registries(parent).pages:
    for element in page:
        # process element
        pass

Debug error string:

debug_error_string = "{"created":"@1596288752.579561214","description":"Error received from peer ipv4:216.58.215.74:443","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"The field 'parent' must be in the form 'projects/{project}/locations/{location}'.","grpc_status":3}"

About:

  • Python 3.8.2
  • google-cloud-iot==1.0.0
  • Ubuntu 20.04.1 LTS

Samples test is failing with `A device with the name...doesn't exist.`

See build log here

<HttpError 404 when requesting https://cloudiot.googleapis.com/v1/projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-09035d0955634ae59a191abfe24fd184-1654641523/devices/test-device-PATCHME?alt=json returned "A device with the name 'projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-09035d0955634ae59a191abfe24fd184-1654641523/devices/test-device-PATCHME' doesn't exist.". Details: "A device with the name 'projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-09035d0955634ae59a191abfe24fd184-1654641523/devices/test-device-PATCHME' doesn't exist.">

samples.api-client.manager.manager_test: many tests failed

Many tests failed at the same time in this package.

  • I will close this issue when there are no more failures in this package and
    there is at least one pass.
  • No new issues will be filed for this package until this issue is closed.
  • If there are already issues for individual test cases, I will close them when
    the corresponding test passes. You can close them earlier, if you prefer, and
    I won't reopen them while this issue is still open.

Here are the tests that failed:

  • test_create_delete_registry
  • test_get_iam_permissions
  • test_add_delete_unauth_device
  • test_add_config_unauth_device
  • test_add_delete_rs256_device
  • test_add_delete_es256_device
  • test_add_patch_delete_rs256
  • test_add_patch_delete_es256
  • test_send_command
  • test_create_gateway
  • test_list_gateways
  • test_bind_device_to_gateway_and_unbind

commit: 93c47da
buildURL: Build Status, Sponge
status: failed

samples.api-client.manager.manager_test: test_send_command failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
  id: "test-registry-d1e57d0645a...opic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d64353898>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
device_registry {
id: "test-registry-d1e57d0645ac..._topic_name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d645cf668>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d64497dc8>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.ALREADY_EXISTS
E details = "A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists."
E debug_error_string = "{"created":"@1626167362.352126831","description":"Error received from peer ipv4:74.125.197.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.","grpc_status":6}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d64353ba8>

@pytest.mark.flaky(max_runs=5, min_passes=1)
def test_send_command(test_topic, capsys):
    device_id = device_id_template.format("RSA256")
    manager.create_registry(
      service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

manager_test.py:427:


manager.py:446: in create_registry
request={"parent": parent, "device_registry": body}
../../../google/cloud/iot_v1/services/device_manager/client.py:447: in create_device_registry
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.ALREADY_EXISTS
details = "A registry with the pa...ns/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.","grpc_status":6}"

???
E google.api_core.exceptions.AlreadyExists: 409 A registry with the parent 'projects/python-docs-samples-tests/locations/us-central1' and ID 'test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' already exists.

:3: AlreadyExists

Synthesis failed for python-iot

Hello! Autosynth couldn't regenerate python-iot. ๐Ÿ’”

Here's the output from running synth.py:

OMMAND_CLASS,
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/tmpfs/tmp/pip-install-t06hsyt6/grpcio/src/python/grpcio/commands.py", line 272, in build_extensions
        "Failed `build_ext` step:\n{}".format(formatted_exception))
    commands.CommandError: Failed `build_ext` step:
    Traceback (most recent call last):
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
        extra_postargs)
      File "/tmpfs/tmp/pip-install-t06hsyt6/grpcio/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
        _classic_spawn(self, command)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/spawn.py", line 36, in spawn
        _spawn_posix(cmd, search_path, dry_run=dry_run)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
        % (cmd, exit_status))
    distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmpfs/tmp/pip-install-t06hsyt6/grpcio/src/python/grpcio/commands.py", line 267, in build_extensions
        build_ext.build_ext.build_extensions(self)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
        _build_ext.build_extension(self, ext)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
        depends=ext.depends)
      File "/tmpfs/tmp/pip-install-t06hsyt6/grpcio/src/python/grpcio/_parallel_compile_patch.py", line 59, in _parallel_compile
        _compile_single_file, objects)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 266, in map
        return self._map_async(func, iterable, mapstar, chunksize).get()
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 644, in get
        raise self._value
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 119, in worker
        result = (True, func(*args, **kwds))
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
        return list(map(*args))
      File "/tmpfs/tmp/pip-install-t06hsyt6/grpcio/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
      File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
        raise CompileError(msg)
    distutils.errors.CompileError: command 'gcc' failed with exit status 1
    
    
    ----------------------------------------
Command "/tmpfs/src/github/synthtool/env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmpfs/tmp/pip-install-t06hsyt6/grpcio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmpfs/tmp/pip-record-fd4722vx/install-record.txt --single-version-externally-managed --compile --install-headers /tmpfs/src/github/synthtool/env/include/site/python3.6/grpcio" failed with error code 1 in /tmpfs/tmp/pip-install-t06hsyt6/grpcio/
You are using pip version 18.1, however version 20.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kbuilder/.cache/synthtool/python-iot/synth.py", line 48, in <module>
    python.py_samples()
  File "/tmpfs/src/github/synthtool/synthtool/languages/python.py", line 132, in py_samples
    sample_readme_metadata = _get_sample_readme_metadata(sample_project_dir)
  File "/tmpfs/src/github/synthtool/synthtool/languages/python.py", line 85, in _get_sample_readme_metadata
    shell.run([sys.executable, "-m", "pip", "install", "-r", requirements])
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'pip', 'install', '-r', '/home/kbuilder/.cache/synthtool/python-iot/samples/api-client/manager/requirements.txt']' returned non-zero exit status 1.
2020-12-03 06:04:24,300 autosynth [ERROR] > Synthesis failed
2020-12-03 06:04:24,300 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at 93c47da chore: add codeowners (#35)
2020-12-03 06:04:24,312 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2020-12-03 06:04:24,319 autosynth [DEBUG] > Running: git clean -fdx
Removing .kokoro/populate-secrets.sh
Removing .pre-commit-config.yaml
Removing __pycache__/
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 354, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 189, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 334, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 65, in synthesize_loop
    has_changes = toolbox.synthesize_version_in_new_branch(synthesizer, youngest)
  File "/tmpfs/src/github/synthtool/autosynth/synth_toolbox.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(synth_log_path, self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 120, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

samples.api-client.manager.manager_test: test_add_patch_delete_es256 failed

This test failed!

To configure my behavior, see the Flaky Bot documentation.

If I'm commenting on this issue too often, add the flakybot: quiet label and
I will stop commenting.


commit: c420c21
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c...Xex4b1JzeJZgG\nSUeTFIUpg/svqd+B4tYZySSYOccVJFUyL805mSgUMQ84/bYAIVybWZqvAQ==\n-----END PUBLIC KEY-----\n"
    }
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1/registries/te...0645ac42cebd4771a17c155ccc-1626167346'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]}
@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
      return callable_(*args, **kwargs)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7d64419cc0>
request = parent: "projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c1...R/Xex4b1JzeJZgG\nSUeTFIUpg/svqd+B4tYZySSYOccVJFUyL805mSgUMQ84/bYAIVybWZqvAQ==\n-----END PUBLIC KEY-----\n"
}
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d...d0645ac42cebd4771a17c155ccc-1626167346'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.38.1 gax/1.31.0 gapic/2.2.0')]
credentials = None, wait_for_ready = None, compression = None

def __call__(self,
             request,
             timeout=None,
             metadata=None,
             credentials=None,
             wait_for_ready=None,
             compression=None):
    state, call, = self._blocking(request, timeout, metadata, credentials,
                                  wait_for_ready, compression)
  return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:946:


state = <grpc._channel._RPCState object at 0x7f7d684fb9b0>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7d646a0c48>
with_call = False, deadline = None

def _end_unary_response_blocking(state, call, with_call, deadline):
    if state.code is grpc.StatusCode.OK:
        if with_call:
            rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
            return state.response, rendezvous
        else:
            return state.response
    else:
      raise _InactiveRpcError(state)

E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.ALREADY_EXISTS
E details = "A device with the parent 'projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' and ID 'test-device-PATCHME' already exists."
E debug_error_string = "{"created":"@1626167360.422973550","description":"Error received from peer ipv4:74.125.135.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"A device with the parent 'projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' and ID 'test-device-PATCHME' already exists.","grpc_status":6}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:849: _InactiveRpcError

The above exception was the direct cause of the following exception:

test_topic = name: "projects/python-docs-samples-tests/topics/test-device-events-36bb52f5-d562-45c9-8ca3-e5088f98284f"

capsys = <_pytest.capture.CaptureFixture object at 0x7f7d64419550>

def test_add_patch_delete_es256(test_topic, capsys):
    device_id = device_id_template.format("PATCHME")
    manager.open_registry(
        service_account_json, project_id, cloud_region, pubsub_topic, registry_id
    )

    manager.create_es256_device(
        service_account_json,
        project_id,
        cloud_region,
        registry_id,
        device_id,
      es_cert_path,
    )

manager_test.py:392:


manager.py:165: in create_es256_device
return client.create_device(request={"parent": parent, "device": device_template})
../../../google/cloud/iot_v1/services/device_manager/client.py:824: in create_device
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.ALREADY_EXISTS
details = "A device with the pare...registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' and ID 'test-device-PATCHME' already exists.","grpc_status":6}"

???
E google.api_core.exceptions.AlreadyExists: 409 A device with the parent 'projects/python-docs-samples-tests/locations/us-central1/registries/test-registry-d1e57d0645ac42cebd4771a17c155ccc-1626167346' and ID 'test-device-PATCHME' already exists.

:3: AlreadyExists

Cloud IoT Manager example does not work in py2 or py3

Hi,

I am trying to follow this example:
https://github.com/googleapis/python-iot/blob/main/samples/api-client/manager/manager.py

I am running this in cloud shell:

python manager.py --project_id=MY-PORJECT --cloud_region=us-central1 --service_account_json=foo.json list-registries
 File "manager.py", line 296
    parent = f"projects/{project_id}/locations/{cloud_region}"
 SyntaxError: invalid syntax                             

and with python3:

Traceback (most recent call last):
  File "manager.py", line 38, in <module>
    from google.cloud import iot_v1
ImportError: cannot import name 'iot_v1' from 'google.cloud' (unknown location)

samples.api-client.manager.manager_test: many tests failed

Many tests failed at the same time in this package.

  • I will close this issue when there are no more failures in this package and
    there is at least one pass.
  • No new issues will be filed for this package until this issue is closed.
  • If there are already issues for individual test cases, I will close them when
    the corresponding test passes. You can close them earlier, if you prefer, and
    I won't reopen them while this issue is still open.

Here are the tests that failed:

  • test_create_delete_registry
  • test_get_iam_permissions
  • test_add_delete_unauth_device
  • test_add_config_unauth_device
  • test_add_delete_rs256_device
  • test_add_delete_es256_device (#140)
  • test_add_patch_delete_rs256 (#141)
  • test_add_patch_delete_es256 (#142)
  • test_send_command (#143)
  • test_create_gateway (#144)
  • test_list_gateways (#145)
  • test_bind_device_to_gateway_and_unbind (#146)

commit: c420c21
buildURL: Build Status, Sponge
status: failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.