|
3 | 3 | from pathlib import Path |
4 | 4 | from typing import Any, ContextManager, Generator, Iterable, Literal, Self, TypeAlias |
5 | 5 |
|
6 | | -from anystore.logging import BoundLogger, get_logger |
| 6 | +from anystore.logging import get_logger |
7 | 7 | from anystore.store.virtual import VirtualIO |
8 | 8 | from anystore.util import clean_dict |
9 | 9 | from banal import ensure_dict |
10 | 10 | from followthemoney import model |
11 | 11 | from followthemoney.proxy import EntityProxy |
12 | 12 | from ftmq.store.fragments.loader import BulkLoader |
13 | 13 | from pydantic import BaseModel, ConfigDict, computed_field |
| 14 | +from structlog.stdlib import BoundLogger |
14 | 15 |
|
15 | 16 | from openaleph_procrastinate import helpers |
16 | 17 | from openaleph_procrastinate.app import App, run_sync_worker |
@@ -139,8 +140,13 @@ def get_entities(self) -> Generator[EntityProxy, None, None]: |
139 | 140 | def load_entities(self: Self) -> Generator[EntityProxy, None, None]: |
140 | 141 | """Load the entities from the store to refresh it to the latest data""" |
141 | 142 | assert "entities" in self.payload, "No entities in payload" |
142 | | - for data in self.payload["entities"]: |
143 | | - yield helpers.load_entity(self.dataset, data["id"]) |
| 143 | + |
| 144 | + # if not dehydrating, just get the payload data: |
| 145 | + if not settings.procrastinate_dehydrate_entities: |
| 146 | + yield from self.get_entities() |
| 147 | + else: |
| 148 | + for data in self.payload["entities"]: |
| 149 | + yield helpers.load_entity(self.dataset, data["id"]) |
144 | 150 |
|
145 | 151 | # Helpers for file jobs that access the servicelayer archive |
146 | 152 |
|
@@ -179,7 +185,7 @@ def from_entities( |
179 | 185 | queue: str, |
180 | 186 | task: str, |
181 | 187 | entities: Iterable[EntityProxy], |
182 | | - dehydrate: bool | None = False, |
| 188 | + dehydrate: bool = settings.procrastinate_dehydrate_entities, |
183 | 189 | **context: Any, |
184 | 190 | ) -> Self: |
185 | 191 | """ |
|
0 commit comments