-
Notifications
You must be signed in to change notification settings - Fork 1
WIP: Jb49688 python3 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Make stacktrace more visible in errors Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
finish() should be called to cleanly exit by invoking stop() Signed-off-by: David Greaves <david.greaves@jolla.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
| password=self.pw, | ||
| virtual_host=self.vhost, | ||
| insist=False) | ||
| self._conn_params = dict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just create pika.ConnectionParameters object here, instead of putting them in separate dict that is then just expanded with **
RuoteAMQP/launcher.py
Outdated
| from amqplib import client_0_8 as amqp | ||
| import pika | ||
|
|
||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This try/except is not needed... remnants from python 2.5 times :) And other places using json seem to have similar pattern
| import logging | ||
| import time | ||
|
|
||
| logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s: %(message)s', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This maybe shouldn't be doing global logging configuration. It's more responsibility of what ever is using the library. Not related to your changes, but just caught my eye.
| self.__participant.consume(self.workitem) | ||
| except Exception as exobj: | ||
| # This should be configureable: | ||
| self.log.error("Exception in participant %s\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use log.exception(...) here and remove the traceback formatting below
| try: | ||
| return self._h['participant_name'] | ||
| except: | ||
| except IndexError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be KeyError?
| BuildArch: noarch | ||
| Vendor: David Greaves <david.greaves@jollamobile.com> | ||
| Url: http://github.com/MeegoIntegration/python-ruote-amqp | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be Requires: python3-pika?
| """ | ||
| Closes channel and connection | ||
| Call finish() to close the channel and connection and exit cleanly. | ||
| This invokes the die() callback which can be overridden to clean up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stop() instead of die()
| """ | ||
| tag = msg.delivery_info["delivery_tag"] | ||
| tag = method.delivery_tag | ||
| self._consumer_tag = method.consumer_tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _consumer_tag should probably be taken from the return value of _channel.basic_consume(), so that it is available if finish() called before any messages have arrived
| self.workitem.wfid, | ||
| self.workitem.wf_name)) | ||
| self.log.error(format_block(traceback.format_exc())) | ||
| self.exception = exobj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem to be necessary to store references to the exception and trace in this thread object anymore, as the error processing is done here (earlier it was on the Participant class side)
| if self.params.forget: | ||
| return True | ||
| except: | ||
| except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.params is a DictAttrProxy, so params.forget would be None if 'forget' is not in the params dict... I'm not sure what kind of exception this could throw, so the whole try/except seem unnecessary
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: David Greaves <david.greaves@jolla.com>
Allow: * setting via [] with __setitem__ * creation by passing a dict which is wrapped (not copied) * pretty __str__ and __unicode__ handlers Signed-off-by: David Greaves <david.greaves@jolla.com>
Convert to python3
Use Pika
Use proper packaging
Support cancel and stop