Comment 0 for bug 1553387

Revision history for this message
Fernando Ribeiro (fribeiro) wrote :

Unlike the API or the WebSocket endpoints, the Python client requires passing the optional 'ttl' and 'grace' parameters due to a validation error in Zaqar.

* Source Code *

from zaqarclient.queues.v1 import client

client = client.Client('http://localhost:8888', conf={'auth_opts':{'options':{'client_uuid':...,'os_auth_token':...,'os_auth_url':'http://localhost:5000/v3.0/','os_project_id':...}}}, version=1.1)

queue = client.queue('SampleQueue')

claim = queue.claim()

for msg in claim
  print msg

* Stack trace for missing 'ttl' parameter *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/queues.py", line 232, in claim
    return claim_api.Claim(self, id=id, ttl=ttl, grace=grace, limit=limit)
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 32, in __init__
    self._create()
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 61, in _create
    limit=self._limit)
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/core.py", line 365, in claim_create
    resp = transport.send(request)
  File "/opt/stack/python-zaqarclient/zaqarclient/transport/http.py", line 107, in send
    raise self.http_to_zaqar[resp.status_code](msg)
zaqarclient.transport.errors.MalformedRequest: The TTL for a claim may not exceed 1209600 seconds, and must be at least 60 seconds long.

* Stack trace for missing 'grace' parameter *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/queues.py", line 232, in claim
    return claim_api.Claim(self, id=id, ttl=ttl, grace=grace, limit=limit)
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 32, in __init__
    self._create()
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 61, in _create
    limit=self._limit)
  File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/core.py", line 365, in claim_create
    resp = transport.send(request)
  File "/opt/stack/python-zaqarclient/zaqarclient/transport/http.py", line 107, in send
    raise self.http_to_zaqar[resp.status_code](msg)
zaqarclient.transport.errors.MalformedRequest: The grace for a claim may not exceed 43200 seconds, and must be at least 60 seconds long.

Please advise if the bug should be first reported against the Python client instead.