Example #1
0
def app(app):
    scheduler.setup(app)
    status.setup(app)
    commander_sim.setup(app)
    datastore.setup(app)
    codec.setup(app)
    return app
def app(app, mocker):
    mocker.patch(TESTED + '.FLUSH_DELAY_S', 0.01)
    mocker.patch(TESTED + '.RETRY_INTERVAL_S', 0.01)
    app['config']['volatile'] = False
    http.setup(app)
    scheduler.setup(app)
    return app
def app(app):
    service_status.setup(app)
    scheduler.setup(app)
    codec.setup(app)
    service_store.setup(app)
    connection_sim.setup(app)
    return app
def app(app):
    app['ini'] = parse_ini(app)
    app['config']['simulation'] = True
    app['config']['volatile'] = True
    app['config']['device_id'] = '123456789012345678901234'

    service_status.setup(app)
    scheduler.setup(app)
    codec.setup(app)

    connection.setup(app)
    commander.setup(app)

    global_store.setup(app)
    service_store.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    synchronization.setup(app)
    controller.setup(app)

    error_response.setup(app)
    blocks_api.setup(app)
    system_api.setup(app)
    settings_api.setup(app)
    mqtt.setup(app)

    return app
Example #5
0
def app(app):
    app['ini'] = parse_ini(app)
    config = app['config']
    config['device_id'] = DEVICE_ID
    config['device_host'] = 'localhost'
    config['device_port'] = 8332
    config['device_serial'] = None
    config['simulation'] = True
    config['volatile'] = True

    service_status.setup(app)

    connection.setup(app)
    commander.setup(app)

    scheduler.setup(app)
    mqtt.setup(app)

    config_store.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    unit_conversion.setup(app)
    codec.setup(app)
    spark.setup(app)

    error_response.setup(app)
    debug_api.setup(app)
    blocks_api.setup(app)
    system_api.setup(app)
    settings_api.setup(app)

    synchronization.setup(app)
    return app
Example #6
0
async def app(app):
    """App + controller routes"""
    scheduler.setup(app)
    sim_api.setup(app)
    app.router.add_routes(routes)

    return app
def app(app):
    service_status.setup(app)
    scheduler.setup(app)
    service_store.setup(app)
    commander_sim.setup(app)
    codec.setup(app)
    return app
def app(app, serial_mock, transport_mock):
    app['config']['device_host'] = None
    status.setup(app)
    http_client.setup(app)
    scheduler.setup(app)
    communication.setup(app)
    return app
Example #9
0
async def app(app, mock_api, mock_publisher):
    app['config']['broadcast_interval'] = 0.01
    app['config']['broadcast_exchange'] = 'testcast'
    app['config']['volatile'] = False
    status.setup(app)
    scheduler.setup(app)
    broadcaster.setup(app)
    return app
def app(app):
    """
    RepeaterFeature depends on the `scheduler` and `http` features being enabled.
    We need to call their setup() functions during our test setup.
    """
    scheduler.setup(app)
    http.setup(app)
    return app
Example #11
0
def app(app, mocker):
    app['config']['command_timeout'] = 1
    service_status.setup(app)
    scheduler.setup(app)
    codec.setup(app)
    connection_sim.setup(app)
    commander.setup(app)
    return app
Example #12
0
def add_events(app: web.Application):
    # Enable the task scheduler
    # This is required for the `events` feature
    scheduler.setup(app)

    # Enable event handling
    # Event subscription / publishing will be enabled after you call this function
    events.setup(app)
def app(app, mocker):
    mocker.patch(DATASTORE + '.FLUSH_DELAY_S', 0.01)
    mocker.patch(DATASTORE + '.RETRY_INTERVAL_S', 0.01)
    app['config']['volatile'] = False
    http.setup(app)
    scheduler.setup(app)
    block_store.setup(app)
    return app
Example #14
0
def app(app):
    """App + controller routes"""
    service_status.setup(app)
    block_store.setup(app)
    commander_sim.setup(app)
    scheduler.setup(app)
    codec.setup(app)
    spark.setup(app)
    return app
Example #15
0
def app(app, m_api, m_publish):
    app['config']['broadcast_interval'] = 0.01
    app['config']['history_topic'] = 'testcast/history'
    app['config']['state_topic'] = 'testcast/state'
    app['config']['volatile'] = False
    service_status.setup(app)
    scheduler.setup(app)
    block_cache.setup(app)
    return app
Example #16
0
async def app(app):
    status.setup(app)
    scheduler.setup(app)
    datastore.setup(app)
    commander_sim.setup(app)
    codec.setup(app)
    device.setup(app)
    seeder.setup(app)
    return app
Example #17
0
def app(app):
    """App + controller routes"""
    status.setup(app)
    datastore.setup(app)
    commander_sim.setup(app)
    scheduler.setup(app)
    codec.setup(app)
    device.setup(app)
    return app
Example #18
0
def main():

    app = service.create_app(parser=create_parser())

    scheduler.setup(app)
    mqtt.setup(app)
    relay.setup(app)

    service.furnish(app)
    service.run(app)
Example #19
0
def main():
    app = service.create_app(parser=create_parser())

    scheduler.setup(app)
    mqtt.setup(app)
    http.setup(app)
    broadcaster.setup(app)

    service.furnish(app)
    service.run(app)
Example #20
0
async def app(app, loop):
    app['config']['volatile'] = True
    service_status.setup(app)
    scheduler.setup(app)
    config_store.setup(app)
    block_store.setup(app)
    commander_sim.setup(app)
    unit_conversion.setup(app)
    codec.setup(app)
    spark.setup(app)
    return app
def app(app):
    service_status.setup(app)
    scheduler.setup(app)
    codec.setup(app)
    connection_sim.setup(app)
    commander.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    global_store.setup(app)
    service_store.setup(app)
    synchronization.setup(app)
    controller.setup(app)
    return app
def add_events(app: web.Application):
    """Add event handling

    Subscriptions can be made at any time using `EventListener.subscribe()`.
    They will be declared on the remote amqp server whenever the listener is connected.

    Message interest can be specified by setting exchange name, and routing key.

    For `direct` and `fanout` exchanges, messages must match routing key exactly.
    For `topic` exchanges (the default), routing keys can be multiple values, separated with dots (.).
    Routing keys can use regex and wildcards.

    The simple wildcards are `*` and `#`.

    `*` matches a single level.

    "controller.*.sensor" subscriptions will receive (example) routing keys:
    - controller.block.sensor
    - controller.container.sensor

    But not:
    - controller
    - controller.nested.block.sensor
    - controller.block.sensor.nested

    `#` is a greedier wildcard: it will match as few or as many values as it can
    Plain # subscriptions will receive all messages published to that exchange.

    A subscription of "controller.#" will receive:
    - controller
    - controller.block.sensor
    - controller.container.nested.sensor

    For more information on this, see https://www.rabbitmq.com/tutorials/tutorial-four-python.html
    and https://www.rabbitmq.com/tutorials/tutorial-five-python.html
    """

    # Enable the task scheduler
    # This is required for the `events` feature
    scheduler.setup(app)

    # Enable event handling
    # Event subscription / publishing will be enabled after you call this function
    events.setup(app)

    # Get the standard event listener
    # This can be used to register as many subscriptions as you want
    listener = events.get_listener(app)

    # Subscribe to all events on 'brewblox' exchange
    listener.subscribe('brewblox', '#', on_message=on_message)
async def app(app, mock_publisher, dummy_listener):
    """App + controller routes"""

    status.setup(app)
    scheduler.setup(app)
    datastore.setup(app)
    commander_sim.setup(app)
    codec.setup(app)
    device.setup(app)
    seeder.setup(app)
    object_api.setup(app)
    remote_api.setup(app)

    return app
def main():
    app = service.create_app(parser=create_parser())
    logging.captureWarnings(True)
    config = app['config']
    app['ini'] = parse_ini(app)

    if getenv('ENABLE_DEBUGGER', False):  # pragma: no cover
        import debugpy
        debugpy.listen(('0.0.0.0', 5678))
        LOGGER.info('Debugger is enabled and listening on 5678')

    if config['simulation']:
        config['device_id'] = config['device_id'] or '123456789012345678901234'
        config['device_host'] = 'localhost'
        config['device_port'] = 8332
        config['device_serial'] = None
        simulator.setup(app)

    service_status.setup(app)
    http.setup(app)

    connection.setup(app)
    commander.setup(app)

    scheduler.setup(app)
    mqtt.setup(app)

    config_store.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    unit_conversion.setup(app)
    codec.setup(app)
    spark.setup(app)
    broadcaster.setup(app)

    error_response.setup(app)
    debug_api.setup(app)
    blocks_api.setup(app)
    system_api.setup(app)
    settings_api.setup(app)
    mqtt_api.setup(app)

    if config['simulation']:
        sim_api.setup(app)

    synchronization.setup(app)

    service.furnish(app)
    service.run(app)
Example #25
0
def app(app):
    app['config']['broadcast_interval'] = 0.01
    app['config']['history_topic'] = 'testcast/history'
    app['config']['state_topic'] = 'testcast/state'
    service_status.setup(app)
    scheduler.setup(app)
    block_cache.setup(app)
    codec.setup(app)
    block_store.setup(app)
    global_store.setup(app)
    service_store.setup(app)
    connection_sim.setup(app)
    commander.setup(app)
    synchronization.setup(app)
    controller.setup(app)
    return app
async def app(app, loop):
    """App + controller routes"""
    service_status.setup(app)
    scheduler.setup(app)
    commander_sim.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    config_store.setup(app)
    unit_conversion.setup(app)
    codec.setup(app)
    synchronization.setup(app)
    spark.setup(app)

    mqtt_api.setup(app)

    return app
Example #27
0
async def app(app, loop, mocker):
    """App + controller routes"""
    mocker.patch(TESTED + '.PUBLISH_INTERVAL_S', 0.001)

    status.setup(app)
    scheduler.setup(app)
    commander_sim.setup(app)
    datastore.setup(app)
    seeder.setup(app)
    codec.setup(app)
    device.setup(app)

    error_response.setup(app)
    sse_api.setup(app)

    return app
Example #28
0
def main():
    app = service.create_app(parser=create_parser())

    scheduler.setup(app)
    events.setup(app)
    influx.setup(app)
    query_api.setup(app)
    sse.setup(app)
    relays.setup(app)

    relays.subscribe(app, exchange_name=OLD_EXCHANGE, routing='#')
    relays.subscribe(app,
                     exchange_name=app['config']['broadcast_exchange'],
                     routing='#')

    service.furnish(app)
    service.run(app)
Example #29
0
async def app(app, event_loop):
    """App + controller routes"""
    scheduler.setup(app)
    service_status.setup(app)
    block_store.setup(app)
    block_cache.setup(app)
    global_store.setup(app)
    service_store.setup(app)
    codec.setup(app)
    connection_sim.setup(app)
    commander.setup(app)
    synchronization.setup(app)
    controller.setup(app)

    mqtt_api.setup(app)

    return app
Example #30
0
def main():
    app = service.create_app(parser=create_parser())

    scheduler.setup(app)
    http.setup(app)
    mqtt.setup(app)
    socket_closer.setup(app)
    victoria.setup(app)
    timeseries_api.setup(app)
    redis.setup(app)
    datastore_api.setup(app)
    relays.setup(app)

    app.middlewares.append(controller_error_middleware)

    service.furnish(app)
    service.run(app)