Vim�UnDo�N?��=��n842f��kx�X�e#w��.J        return [Consumer(queues=self.queues, callbacks=[self.on_message])]G1111]��e_�����]��#�5�_�����]��0��5�_�����V]��2�     class Worker(ConsumerMixin):/        def __init__(self, connection, queues):(            self.connection = connection             self.queues = queues3        def get_consumers(self, Consumer, channel):N            return [Consumer(queues=self.queues, callbacks=[self.on_message])],        def on_message(self, body, message):            if message:/                body = json.loads(message.body)F                logger.info("Got pubsub message body={}".format(body))K                CoinmineRequests.put(minary_api_server_url, "config", body)                message.ack()5�_�����V]��6�        �5�_�����V]��`��5�_�����V]��d��5�_�	����V]��j�	         self.callback = callback5�_�	����V]�͌��5�_�
	����V]�͍�import json&from kombu.mixins import ConsumerMixin+from utils.requests import CoinmineRequestsclass Worker(ConsumerMixin):+    def __init__(self, connection, queues):$        self.connection = connection        self.queues = queues/    def get_consumers(self, Consumer, channel):J        return [Consumer(queues=self.queues, callbacks=[self.on_message])](    def on_message(self, body, message):        if message:+            body = json.loads(message.body)B            logger.info("Got pubsub message body={}".format(body))G            CoinmineRequests.put(minary_api_server_url, "config", body)            message.ack()5�_�	

����V]�͢�
        �
5�_�
)����V]�ͪ�	+    def __init__(self, connection, queues):5�_�2����V]�ͳ�            �5�_�
����V]���class Worker(ConsumerMixin):5�_�����V]�� �            self.callback()5�_�����V]��"�
         self.callback = callback5�_�)����V]��%�	5    def __init__(self, connection, queues, callback):5�_�����V]��`��5�_�����V]��a�%    logger = CoinmineLogger(__name__)5�_�����V]��v��5�_�����V]��{�<from utils import SystemHelpers, CoinmineLogger, sentry_init5�_�!����V]��}�.from utils import  CoinmineLogger, sentry_init5�_� ����V]��}	�import json&from kombu.mixins import ConsumerMixin+from utils.requests import CoinmineRequests!from utils import  CoinmineLogger!logger = CoinmineLogger(__name__)$class ConfigConsumer(ConsumerMixin):+    def __init__(self, connection, queues):$        self.connection = connection        self.queues = queues/    def get_consumers(self, Consumer, channel):J        return [Consumer(queues=self.queues, callbacks=[self.on_message])](    def on_message(self, body, message):        if message:+            body = json.loads(message.body)B            logger.info("Got pubsub message body={}".format(body))G            CoinmineRequests.put(minary_api_server_url, "config", body)            message.ack()5�_�

����V]����
        �
5�_�)����V]����
+    def __init__(self, connection, queues):5�_�����V]��A
�        �5�_�����V]����
        self.fun = fun
        self.5�_�)����V]����
0    def __init__(self, connection, queues, fun):5�_� !����V]���G            CoinmineRequests.put(minary_api_server_url, "config", body)5�_�! 
����V]��#�
��
5�_� "!����V]��$�
self.minary_api_server_url5�_�!#"����V]��%�
    self.minary_api_server_url5�_�"$#"����V]��&�
"        self.minary_api_server_url5�_�#%$)����V]��*�
+    def __init__(self, connection, queues):5�_�$&%?����V]��-�import json&from kombu.mixins import ConsumerMixin+from utils.requests import CoinmineRequests from utils import CoinmineLogger!logger = CoinmineLogger(__name__)$class ConfigConsumer(ConsumerMixin):B    def __init__(self, connection, queues, minary_api_server_url):$        self.connection = connection        self.queues = queues9        self.minary_api_server_url= minary_api_server_url/    def get_consumers(self, Consumer, channel):J        return [Consumer(queues=self.queues, callbacks=[self.on_message])](    def on_message(self, body, message):        if message:+            body = json.loads(message.body)B            logger.info("Got pubsub message body={}".format(body))L            CoinmineRequests.put(self.minary_api_server_url, "config", body)            message.ack()5�_�%'&&����V]��d�+            body = json.loads(message.body)5�_�&('����V]��g�            �5�_�')(����V]���            print5�_�(*)����V]����            print(body)5�_�)+*����V]����            print(body)5�_�*,+����V]����#            body = json.loads(body)5�_�+-,����V]����            body = jsobody)5�_�,.-����V]��%�#            print(body, type(body))5�_�-/.G����]��L�J        return [Consumer(queues=self.queues, callbacks=[self.on_message])]5�_�.0/G����]��`�^        return [Consumer(queues=self.queues, callbacks=[self.on_message, auto_declare=False])]5�_�/10\����]��c�_        return [Consumer(queues=self.queues, callbacks=[self.on_message], auto_declare=False])]5�_�01\����]��d�import json&from kombu.mixins import ConsumerMixin+from utils.requests import CoinmineRequests from utils import CoinmineLogger!logger = CoinmineLogger(__name__)$class ConfigConsumer(ConsumerMixin):B    def __init__(self, connection, queues, minary_api_server_url):$        self.connection = connection        self.queues = queues:        self.minary_api_server_url = minary_api_server_url/    def get_consumers(self, Consumer, channel):^        return [Consumer(queues=self.queues, callbacks=[self.on_message], auto_declare=False)](    def on_message(self, body, message):        if message:B            logger.info("Got pubsub message body={}".format(body))L            CoinmineRequests.put(self.minary_api_server_url, "config", body)            message.ack()5�_� !����V]��!�2            CoinmineRequests.put(, "config", body)5�_�����V]��s��%    logger = CoinmineLogger(__name__)5�_�
����V]����5��
예제 #2
0
Vim�UnDo������.���	U�{��~�`|8h��Q2                             {'power-down': True})"%5555\��?_�����\��`�>�>5�_�����\��e�?Nfrom utils import SystemHelpers, CoinmineRequests, CoinmineLogger, sentry_init5�_�?����\�N��?5�_�@����\�N��@�A�@5�_�A����\�O�@A2signal.signal(signal.SIGTERM, signal_term_handler)5�_�����\�O�A�A�@5�_�����V\�O�B2signal.signal(signal.SIGTERM, signal_term_handler)5�_�	����V\�O�6    signal.signal(signal.SIGTERM, signal_term_handler)5�_�
	����V\�O�A�A5�_�	
����V\�O�C�B5�_�
����V\�O �5�_�
B����V\�O8�B�C�B5�_�
D
����V\�O?�CEE    print 'got SIGTERM'5�_�
D����V\�OA�CEE    print ()'got SIGTERM'5�_�D����V\�OE�CD    print ('got SIGTERM')5�_�C����V\�OF�CEE    �CED5�_�D/����V\�OY�CEE0    logger.info('got signal handler, signal={}')5�_�B����V\�O_�BDE5�_�4+����V\�Of�36FL                    **CoinmineRequests.get(minary_api_server_url, 'config'),5�_�6+����V\�Oh�58GQ                    **CoinmineRequests.get(minary_api_server_url, 'system_info'),5�_�8+����V\�Oj	�7:HR                    **CoinmineRequests.get(minary_api_server_url, 'miner_status'),5�_�<����V\�Om
�;<5�_�D����DHV\�Ox�CD'def signal_term_handler(signal, frame):?    logger.info('got signal handler, signal={}'.format(signal))    sys.exit(0)5�_�
����DDV\�O{�D�D�
C5�_�
����JJV\�O|�
5�_�����IIV\�O}�H5�_�����JJV\�QK�I5�_�����KKV\�Q��K    �J5�_�����LLV\�R�K    CoinmineRequests.put()5�_�>����LLV\�R�K?    CoinmineRequests.put(minary_api_server_url, 'miner_status')5�_� M����LLV\�R$
�KO    CoinmineRequests.put(minary_api_server_url, 'miner_status', {'power-down'})5�_�! /����LLV\�R,�KU    CoinmineRequests.put(minary_api_server_url, 'miner_status', {'power-down': True})5�_� "!(����MMV\�R.�L>                         'miner_status', {'power-down': True})5�_�!#"����
V
\�S��'def signal_term_handler(signal, frame):?    logger.info('got signal handler, signal={}'.format(signal))/    CoinmineRequests.put(minary_api_server_url,(                         'miner_status',.                         {'power-down': True})    sys.exit(0)5�_�"$#����
V
\�S��G�G�F5�_�#%$����V\�S��N'def signal_term_handler(signal, frame):?    logger.info('got signal handler, signal={}'.format(signal))/    CoinmineRequests.put(minary_api_server_url,(                         'miner_status',.                         {'power-down': True})    sys.exit(0)5�_�$&%����V\�S��5�_�%'&����V\�S��5�_�&('����V\�S��+    def signal_term_handler(signal, frame):C        logger.info('got signal handler, signal={}'.format(signal))3        CoinmineRequests.put(minary_api_server_url,+                            'miner_status',1                            {'power-down': True})        sys.exit(0)5�_�')(����V\�S��F�F5�_�(*)����V\�S��L+                            'miner_status',5�_�)+*����V\�S��L1                            {'power-down': True})5�_�*,+����
V\�S��5�_�+-,����V\�S��+    def signal_term_handler(signal, frame):C        logger.info('got signal handler, signal={}'.format(signal))3        CoinmineRequests.put(minary_api_server_url,,                             'miner_status',2                             {'power-down': True})        sys.exit(0)6    signal.signal(signal.SIGTERM, signal_term_handler)5�_�,.-����V\�S��%B�B5�_�-/.����V\�S��K�J5�_�.0/#����\�X�#%K�#$K5�_�/10$����$$V\�X�#%L%            ambiance.run(full_status)5�_�021#����04V\�X$�#)L�#$L5�_�132$����$(V\�X%�#)Q    full_status = {@        **CoinmineRequests.get(minary_api_server_url, 'config'),E        **CoinmineRequests.get(minary_api_server_url, 'system_info'),F        **CoinmineRequests.get(minary_api_server_url, 'miner_status'),    }5�_�243#����$(V\�Y
�"#        sys.exit(0)5�_�354(����#'V\�Y�(*P�()P5�_�45"%����\��>�!#Q2                             {'power-down': True})5��