Commit fd6102da authored by Marius Kriegerowski's avatar Marius Kriegerowski
Browse files

rebase and adapt to new celery implementation

parent 01df5344
Pipeline #38935 failed with stage
in 2 minutes and 49 seconds
......@@ -106,6 +106,7 @@ class RulesOneUniqueSubGroup:
)
@Rule.app.task(bind=True, base=Rule)
class GetBuildingOccupancy(Rule):
"""A rule to map OSM tags to building occupancies."""
......@@ -123,16 +124,15 @@ class GetBuildingOccupancy(Rule):
RulesOneUniqueSubGroup,
]
async def evaluate(self, payload: dict) -> GEMTag:
building_id = payload["building_id"]
def evaluate(self, building_id: int) -> GEMTag | None:
logger.debug("Processing building: %s", building_id)
tags = await self.storage.expect_one(
tags = self.storage.expect_one(
f"SELECT tags FROM osm_building_relations WHERE osm_id={building_id} AND index=0"
)
logger.debug(f"working on tags: {tags}")
if not tags:
return
return
# Mapping to GEM taxonomy strings
occupancies = []
......@@ -147,7 +147,3 @@ class GetBuildingOccupancy(Rule):
logger.debug("occupancies %s: %s", building_id, occupancy)
return occupancy
async def apply_mappings(self, tags):
for rule in self.candidates:
rule.apply(tags)
......@@ -37,7 +37,7 @@ class GetBuilding(Rule):
"""A rule to copy a building entry from a source database to a destination database."""
@Rule.app.task(bind=True, base=Rule)
def evaluate(self, building_id):
def evaluate(self, building_id: int):
logger.info("called building task")
......
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