Commit 3681950b authored by Marius Kriegerowski's avatar Marius Kriegerowski
Browse files

Grouped rules in assembly

parent 177a199a
Pipeline #27124 passed with stage
in 1 minute and 13 seconds
......@@ -21,7 +21,7 @@ import sys
import asyncio
import argparse
from rabotnik import Rabotnik
from rabotnik import Rabotnik, Assembly
from rabotnik.bus import MessageBus
from rules import GetBuilding # pylint: disable=import-error
......@@ -57,17 +57,15 @@ async def main():
storage_obmbuildings = rabotnik.get_storage("postgresql")
await storage_obmbuildings.connect(config_file="/etc/rabotnik/storage-obmbuildings.yml")
rule = GetBuilding(storage_osmreplication, storage_obmbuildings)
await message_bus.subscribe("building", rule.evaluate)
rules = [
GetBuilding(storage_osmreplication, storage_obmbuildings),
GetFloorspace(storage_osmreplication, storage_obmbuildings),
GetBuildingLandUse(storage_osmreplication),
GetPointsInBuilding(storage_osmreplication),
]
rules = Assembly(rules=rules)
rule = GetFloorspace(storage_osmreplication, storage_obmbuildings)
await message_bus.subscribe("building", rule.evaluate)
rule = GetBuildingLandUse(storage_osmreplication)
await message_bus.subscribe("building", rule.evaluate)
rule = GetPointsInBuilding(storage_osmreplication)
await message_bus.subscribe("building", rule.evaluate)
await message_bus.subscribe("building", rules.run)
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment