fix(prediction): correct dataset mapping
This commit is contained in:
parent
7f70ebdd96
commit
a53adc4585
3 changed files with 107 additions and 3 deletions
|
|
@ -5,6 +5,12 @@ from typing import Any
|
|||
from zoneinfo import ZoneInfo
|
||||
from collections import OrderedDict
|
||||
|
||||
# Request value meaning "let the predictor use whatever run it has loaded".
|
||||
# Lives here because this module is the one that decides what reaches the
|
||||
# predictor; the serializer imports it as its default.
|
||||
LATEST_DATASET_KEYWORD = "latest"
|
||||
|
||||
|
||||
class TawhiriClient:
|
||||
BASE_URL = "http://127.0.0.1:8080/api/v1/prediction"
|
||||
TIMEOUT = 15
|
||||
|
|
@ -36,7 +42,20 @@ class TawhiriClient:
|
|||
query["burst_altitude"] = params.get("burst_altitude")
|
||||
query["descent_rate"] = params.get("descent_rate")
|
||||
query["interpolate"] = str(params.get("interpolate", False)).lower()
|
||||
#query["dataset"] = cls._convert_value(params.get("dataset"))
|
||||
# Forwarded only when the operator actually named a run.
|
||||
#
|
||||
# The predictor now honours this parameter and refuses a run it does not
|
||||
# hold, so anything that is not a real epoch must not be sent. Two values
|
||||
# reach here that are not: "" from the UI, and LATEST_DATASET_KEYWORD, the
|
||||
# serializer's default, which means "server chooses" — exactly what
|
||||
# omitting the parameter does. The `filtered` comprehension below drops
|
||||
# None but neither of these.
|
||||
#
|
||||
# A malformed epoch is deliberately still forwarded, so the predictor
|
||||
# rejects it instead of the value being quietly ignored.
|
||||
dataset = params.get("dataset")
|
||||
if dataset and dataset != LATEST_DATASET_KEYWORD:
|
||||
query["dataset"] = cls._convert_value(dataset)
|
||||
query["format"] = params.get("format", "json")
|
||||
query["pred_type"] = "single" # <-- в конце
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue