quickfix
This commit is contained in:
parent
ee88be4c80
commit
350448ec0f
@ -1,11 +1,23 @@
|
|||||||
"""Implements a config object with dot-indexing syntax."""
|
"""Implements a config object with dot-indexing syntax."""
|
||||||
|
|
||||||
|
|
||||||
from envyaml import EnvYAML
|
from envyaml import EnvYAML
|
||||||
|
|
||||||
from pyinfra.locations import CONFIG_FILE
|
from pyinfra.locations import CONFIG_FILE
|
||||||
|
|
||||||
|
|
||||||
|
def make_art():
|
||||||
|
return """
|
||||||
|
______ _____ __
|
||||||
|
| ___ \ |_ _| / _|
|
||||||
|
| |_/ / _ | | _ __ | |_ _ __ __ _
|
||||||
|
| __/ | | || || '_ \| _| '__/ _` |
|
||||||
|
| | | |_| || || | | | | | | | (_| |
|
||||||
|
\_| \__, \___/_| |_|_| |_| \__,_|
|
||||||
|
__/ |
|
||||||
|
|___/
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def _get_item_and_maybe_make_dotindexable(container, item):
|
def _get_item_and_maybe_make_dotindexable(container, item):
|
||||||
ret = container[item]
|
ret = container[item]
|
||||||
return DotIndexable(ret) if isinstance(ret, dict) else ret
|
return DotIndexable(ret) if isinstance(ret, dict) else ret
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import abc
|
|||||||
|
|
||||||
|
|
||||||
class Connection(abc.ABC):
|
class Connection(abc.ABC):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def establish(self):
|
def establish(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -2,6 +2,5 @@ from pyampq.connection.connection import Connection
|
|||||||
|
|
||||||
|
|
||||||
class MockConnection(Connection):
|
class MockConnection(Connection):
|
||||||
|
|
||||||
def establish(self):
|
def establish(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
class PikaConnection:
|
class PikaConnection:
|
||||||
|
|
||||||
def establish(self):
|
def establish(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -43,16 +43,9 @@ def monkey_patch_queue_handle(channel, queue) -> QueueHandle:
|
|||||||
|
|
||||||
def get_connection():
|
def get_connection():
|
||||||
|
|
||||||
credentials = pika.PlainCredentials(
|
credentials = pika.PlainCredentials(username=CONFIG.rabbitmq.user, password=CONFIG.rabbitmq.password)
|
||||||
username=CONFIG.rabbitmq.user,
|
|
||||||
password=CONFIG.rabbitmq.password
|
|
||||||
)
|
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {"host": CONFIG.rabbitmq.host, "port": CONFIG.rabbitmq.port, "credentials": credentials}
|
||||||
"host": CONFIG.rabbitmq.host,
|
|
||||||
"port": CONFIG.rabbitmq.port,
|
|
||||||
"credentials": credentials
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters = pika.ConnectionParameters(**kwargs)
|
parameters = pika.ConnectionParameters(**kwargs)
|
||||||
|
|
||||||
@ -62,7 +55,6 @@ def get_connection():
|
|||||||
|
|
||||||
|
|
||||||
class PikaQueueManager(QueueManager):
|
class PikaQueueManager(QueueManager):
|
||||||
|
|
||||||
def __init__(self, input_queue, output_queue):
|
def __init__(self, input_queue, output_queue):
|
||||||
super().__init__(input_queue, output_queue)
|
super().__init__(input_queue, output_queue)
|
||||||
connection = get_connection()
|
connection = get_connection()
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import abc
|
|||||||
|
|
||||||
|
|
||||||
class QueueHandle:
|
class QueueHandle:
|
||||||
|
|
||||||
def empty(self) -> bool:
|
def empty(self) -> bool:
|
||||||
raise NotImplemented()
|
raise NotImplemented()
|
||||||
|
|
||||||
@ -11,7 +10,6 @@ class QueueHandle:
|
|||||||
|
|
||||||
|
|
||||||
class QueueManager(abc.ABC):
|
class QueueManager(abc.ABC):
|
||||||
|
|
||||||
def __init__(self, input_queue, output_queue):
|
def __init__(self, input_queue, output_queue):
|
||||||
self._input_queue = input_queue
|
self._input_queue = input_queue
|
||||||
self._output_queue = output_queue
|
self._output_queue = output_queue
|
||||||
|
|||||||
@ -10,7 +10,6 @@ def monkey_patch_queue_handle(queue) -> QueueHandle:
|
|||||||
|
|
||||||
|
|
||||||
class QueueManagerMock(QueueManager):
|
class QueueManagerMock(QueueManager):
|
||||||
|
|
||||||
def __init__(self, input_queue, output_queue):
|
def __init__(self, input_queue, output_queue):
|
||||||
super().__init__(QueueMock(), QueueMock())
|
super().__init__(QueueMock(), QueueMock())
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ def consumer(queue_manager, callback):
|
|||||||
# consumer.consume()
|
# consumer.consume()
|
||||||
# assert queue_manager.output_queue.empty()
|
# assert queue_manager.output_queue.empty()
|
||||||
|
|
||||||
|
|
||||||
def test_consuming_nonempty_input_queue_puts_messages_on_output_queue_in_fifo_order(consumer, queue_manager, callback):
|
def test_consuming_nonempty_input_queue_puts_messages_on_output_queue_in_fifo_order(consumer, queue_manager, callback):
|
||||||
queue_manager.clear()
|
queue_manager.clear()
|
||||||
queue_manager.publish_request(1)
|
queue_manager.publish_request(1)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ from pyinfra.callback import (
|
|||||||
make_retry_callback,
|
make_retry_callback,
|
||||||
make_callback_for_output_queue,
|
make_callback_for_output_queue,
|
||||||
)
|
)
|
||||||
from pyinfra.config import CONFIG
|
from pyinfra.config import CONFIG, make_art
|
||||||
from pyinfra.consume import consume, ConsumerError
|
from pyinfra.consume import consume, ConsumerError
|
||||||
from pyinfra.core import make_payload_processor, make_storage_data_loader, make_analyzer
|
from pyinfra.core import make_payload_processor, make_storage_data_loader, make_analyzer
|
||||||
from pyinfra.flask import run_probing_webserver, set_up_probing_webserver
|
from pyinfra.flask import run_probing_webserver, set_up_probing_webserver
|
||||||
@ -49,6 +49,7 @@ def make_callback():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# TODO: implement meaningful checks
|
# TODO: implement meaningful checks
|
||||||
|
logging.info(make_art())
|
||||||
webserver = Process(target=run_probing_webserver, args=(set_up_probing_webserver(),))
|
webserver = Process(target=run_probing_webserver, args=(set_up_probing_webserver(),))
|
||||||
logging.info("Starting webserver...")
|
logging.info("Starting webserver...")
|
||||||
webserver.start()
|
webserver.start()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user