mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
implementing scenario_ids_ignored feedback
This commit is contained in:
parent
e645f90b0e
commit
f13bffec7c
2 changed files with 6 additions and 10 deletions
|
|
@ -34,3 +34,7 @@ class ExportRequest(BaseModel):
|
|||
object.__setattr__(self, "_scenario_ids_ignored", False)
|
||||
|
||||
return self
|
||||
|
||||
@property
|
||||
def scenario_ids_ignored(self) -> bool:
|
||||
return self._scenario_ids_ignored
|
||||
|
|
|
|||
|
|
@ -100,15 +100,7 @@ def process_export(payload: ExportRequest, session: Session) -> Dict[Union[str,
|
|||
|
||||
def handler(event: Mapping[str, Any], context: Optional[Any]) -> Mapping[str, Union[int, str]]:
|
||||
"""
|
||||
Lambda event should have the following structure:
|
||||
1) task id - unique identifier for the export task (optional, can be used for tracking/logging)
|
||||
2) subtask id - unique identifier for the specific export operation (optional, can be used for tracking/logging)
|
||||
2) portfolio id - id of the portfolio to export
|
||||
3) scenario ids - list of scenario ids to export
|
||||
4) default_plans_only - flag indicating if we should only consider default plans for export (optional,
|
||||
defaults to False)
|
||||
|
||||
Exxample event:
|
||||
Example event:
|
||||
body_dict = {
|
||||
"task_id": "test",
|
||||
"subtask_id": "test",
|
||||
|
|
@ -127,7 +119,7 @@ def handler(event: Mapping[str, Any], context: Optional[Any]) -> Mapping[str, Un
|
|||
logger.debug("Validating request body")
|
||||
payload = ExportRequest.model_validate(body_dict)
|
||||
|
||||
if getattr(payload, "_scenario_ids_ignored", False):
|
||||
if payload.scenario_ids_ignored:
|
||||
logger.warning(
|
||||
"Received scenario_ids in request body but they will be ignored "
|
||||
"because default_plans_only is set to True"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue