pygate / pygate-gRPC

A Python gRPC Powergate client
http://pygate.tech
MIT License
22 stars 5 forks source link

set_default_config is resulting in grpc._channel._InactiveRpcError #40

Closed peterVG closed 4 years ago

peterVG commented 4 years ago

To reproduce, run https://github.com/pygate/pygate-gRPC/blob/main/examples/ffs_config.py using https://github.com/pygate/pygate-gRPC/blob/main/cidconfig.json.

The error output:

Traceback (most recent call last):
  File "test.py", line 18, in <module>
    client.ffs.set_default_config(config, tk)
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/pygate_grpc/errors.py", line 19, in wrapper
    raise err_to_raise
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/pygate_grpc/errors.py", line 14, in wrapper
    return func(*args, **kwargs)
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/pygate_grpc/ffs.py", line 86, in set_default_config
    return self.client.SetDefaultStorageConfig(req, metadata=self._get_meta_data(token))
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/grpc/_channel.py", line 826, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.UNKNOWN
    details = "default cid config is invalid: hot-ipfs config is invalid: invalid ipfs config: add timeout should be greater than 0 seconds, got 0"
    debug_error_string = "{"created":"@1601433405.721481000","description":"Error received from peer ipv4:127.0.0.1:5002","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"default cid config is invalid: hot-ipfs config is invalid: invalid ipfs config: add timeout should be greater than 0 seconds, got 0","grpc_status":2}"
>

This is a new error that's resulting as an incompatible change made to an updated Powergate version.

peterVG commented 4 years ago

Using the example from this related PR (set_default_config demo).

https://github.com/pygate/pygate-gRPC/pull/35/commits

produces a different error:

Traceback (most recent call last):
  File "config.py", line 34, in <module>
    client.ffs.set_default_config(Parse(newConfig, StorageConfig()), tk)
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/pygate_grpc/errors.py", line 14, in wrapper
    return func(*args, **kwargs)
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/pygate_grpc/ffs.py", line 84, in set_default_config
    config = Parse(config, ffs_rpc_pb2.StorageConfig())
  File "/Users/peter/Development/pygate/venv/lib/python3.8/site-packages/google/protobuf/json_format.py", line 429, in Parse
    if not isinstance(text, six.text_type): text = text.decode('utf-8')
AttributeError: decode
peterVG commented 4 years ago

The method for setting the default config in Powergate is now called SetDefaultStorageConfig so we probably just need to update the client to ffs.set_default_storage_config