Skip to content
Snippets Groups Projects
Commit 198f3f40 authored by Tim Repke's avatar Tim Repke
Browse files

fix build

parent f931877d
No related branches found
No related tags found
1 merge request!60Master
Pipeline #2139 failed
...@@ -141,33 +141,34 @@ async def bg_populate_tracker(tracker_id: str, batch_size: int | None = None, la ...@@ -141,33 +141,34 @@ async def bg_populate_tracker(tracker_id: str, batch_size: int | None = None, la
if labels is None or len(labels) == 0: if labels is None or len(labels) == 0:
labels = tracker.labels labels = tracker.labels
flat_labels = [lab for batch in labels for lab in batch] if labels is not None:
flat_labels = [lab for batch in labels for lab in batch]
recall = compute_recall(labels_=flat_labels) recall = compute_recall(labels_=flat_labels)
if tracker.recall is None: if tracker.recall is None:
tracker.recall = recall tracker.recall = recall
else: else:
tracker.recall += recall tracker.recall += recall
await session.flush()
# Initialise buscar scores
if tracker.buscar is None:
tracker.buscar = []
if batch_size is None:
# Use scopes as batches
it = calculate_h0s_for_batches(labels=tracker.labels,
recall_target=tracker.recall_target,
n_docs=tracker.n_items_total)
else:
# Ignore the batches derived from scopes and use fixed step sizes
it = calculate_h0s(labels_=flat_labels,
batch_size=batch_size,
recall_target=tracker.recall_target,
n_docs=tracker.n_items_total)
for x, y in it:
tracker.buscar = tracker.buscar + [(x, y)]
# save after each step, so the user can refresh the page and get data as it becomes available
await session.flush() await session.flush()
# Initialise buscar scores
if tracker.buscar is None:
tracker.buscar = []
if batch_size is None:
# Use scopes as batches
it = calculate_h0s_for_batches(labels=tracker.labels,
recall_target=tracker.recall_target,
n_docs=tracker.n_items_total)
else:
# Ignore the batches derived from scopes and use fixed step sizes
it = calculate_h0s(labels_=flat_labels,
batch_size=batch_size,
recall_target=tracker.recall_target,
n_docs=tracker.n_items_total)
for x, y in it:
tracker.buscar = tracker.buscar + [(x, y)]
# save after each step, so the user can refresh the page and get data as it becomes available
await session.flush()
...@@ -6,7 +6,7 @@ import os ...@@ -6,7 +6,7 @@ import os
from pydantic_settings import SettingsConfigDict, BaseSettings from pydantic_settings import SettingsConfigDict, BaseSettings
from pydantic.networks import PostgresDsn from pydantic.networks import PostgresDsn
from pydantic import field_validator, FieldValidationInfo, AnyHttpUrl, BaseModel, EmailStr from pydantic import field_validator, ValidationInfo, AnyHttpUrl, BaseModel, EmailStr
# For more information how BaseSettings work, check the documentation: # For more information how BaseSettings work, check the documentation:
...@@ -60,7 +60,7 @@ class DatabaseConfig(BaseModel): ...@@ -60,7 +60,7 @@ class DatabaseConfig(BaseModel):
CONNECTION_STR: PostgresDsn | None = None CONNECTION_STR: PostgresDsn | None = None
@field_validator('CONNECTION_STR', mode='before') @field_validator('CONNECTION_STR', mode='before')
def build_connection_string(cls, v: str | None, info: FieldValidationInfo) -> PostgresDsn: def build_connection_string(cls, v: str | None, info: ValidationInfo) -> PostgresDsn:
assert info.config is not None assert info.config is not None
if isinstance(v, str): if isinstance(v, str):
...@@ -88,7 +88,7 @@ class EmailConfig(BaseModel): ...@@ -88,7 +88,7 @@ class EmailConfig(BaseModel):
@field_validator('ENABLED', mode='before') @field_validator('ENABLED', mode='before')
@classmethod @classmethod
def get_emails_enabled(cls, v: str | None, info: FieldValidationInfo) -> bool: def get_emails_enabled(cls, v: str | None, info: ValidationInfo) -> bool:
assert info.config is not None assert info.config is not None
return bool( return bool(
info.data.get('SMTP_HOST') info.data.get('SMTP_HOST')
...@@ -135,7 +135,7 @@ class Settings(BaseSettings): ...@@ -135,7 +135,7 @@ class Settings(BaseSettings):
@field_validator('LOGGING_CONF', mode='before') @field_validator('LOGGING_CONF', mode='before')
@classmethod @classmethod
def get_emails_enabled(cls, v: dict[str, Any] | None, info: FieldValidationInfo) -> dict[str, Any]: def get_emails_enabled(cls, v: dict[str, Any] | None, info: ValidationInfo) -> dict[str, Any]:
assert info.config is not None assert info.config is not None
if isinstance(v, dict): if isinstance(v, dict):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment