-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from gabrielmscampos/feat/add-ml-clients
- Loading branch information
Showing
10 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from ...utils.api_client import BaseAuthorizedAPIClient | ||
from .models import MLBadLumisection, MLBadLumisectionFilters, PaginatedMLBadLumisectionList | ||
|
||
|
||
class MLBadLumisectionClient(BaseAuthorizedAPIClient): | ||
data_model = MLBadLumisection | ||
pagination_model = PaginatedMLBadLumisectionList | ||
filter_class = MLBadLumisectionFilters | ||
lookup_url = "ml-bad-lumisection/" | ||
|
||
def get(self, model_id: int, dataset_id: int, run_number: int, ls_number: int, me_id: int, **kwargs): | ||
edp = f"{model_id}/{dataset_id}/{run_number}/{ls_number}/{me_id}/" | ||
return super().get(edp, **kwargs) | ||
|
||
def cert_json(self, model_id__in: list[int], dataset_id__in: list[int], run_number__in: list[int], **kwargs): | ||
edp = "cert-json/" | ||
midin = ",".join(str(v) for v in model_id__in) | ||
didin = ",".join(str(v) for v in dataset_id__in) | ||
ridin = ",".join(str(v) for v in run_number__in) | ||
params = {"model_id__in": midin, "dataset_id__in": didin, "run_number__in": ridin} | ||
return super().get(edp, params=params, return_raw_json=True, **kwargs) | ||
|
||
def golden_json(self, model_id__in: list[int], dataset_id__in: list[int], run_number__in: list[int], **kwargs): | ||
edp = "golden-json/" | ||
midin = ",".join(str(v) for v in model_id__in) | ||
didin = ",".join(str(v) for v in dataset_id__in) | ||
ridin = ",".join(str(v) for v in run_number__in) | ||
params = {"model_id__in": midin, "dataset_id__in": didin, "run_number__in": ridin} | ||
return super().get(edp, params=params, return_raw_json=True, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from typing import Optional | ||
|
||
from pydantic import AnyUrl, BaseModel | ||
|
||
from ...utils.base_model import OBaseModel, PaginatedBaseModel | ||
|
||
|
||
class MLBadLumisection(BaseModel): | ||
model_id: int | ||
dataset_id: int | ||
file_id: int | ||
run_number: int | ||
ls_number: int | ||
me_id: int | ||
mse: float | ||
|
||
|
||
class PaginatedMLBadLumisectionList(PaginatedBaseModel): | ||
next: Optional[AnyUrl] | ||
previous: Optional[AnyUrl] | ||
results: list[MLBadLumisection] | ||
|
||
|
||
class MLBadLumisectionFilters(OBaseModel): | ||
next_token: Optional[str] = None | ||
page_size: Optional[int] = None | ||
model_id: Optional[int] = None | ||
model_id__in: Optional[list[int]] = None | ||
dataset_id: Optional[int] = None | ||
dataset_id__in: Optional[list[int]] = None | ||
dataset: Optional[str] = None | ||
dataset__regex: Optional[str] = None | ||
me_id: Optional[int] = None | ||
me: Optional[str] = None | ||
me__regex: Optional[str] = None | ||
run_number: Optional[int] = None | ||
run_number__in: Optional[list[int]] = None | ||
ls_number: Optional[int] = None |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from ...utils.api_client import BaseAuthorizedAPIClient | ||
from .models import MLModelsIndex, MLModelsIndexFilters, PaginatedMLModelsIndexList | ||
|
||
|
||
class MLModelsIndexClient(BaseAuthorizedAPIClient): | ||
data_model = MLModelsIndex | ||
pagination_model = PaginatedMLModelsIndexList | ||
filter_class = MLModelsIndexFilters | ||
lookup_url = "ml-models-index/" | ||
|
||
def get(self, model_id: int, **kwargs): | ||
edp = f"{model_id}/" | ||
return super().get(edp, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import Optional | ||
|
||
from pydantic import AnyUrl, BaseModel | ||
|
||
from ...utils.base_model import OBaseModel, PaginatedBaseModel | ||
|
||
|
||
class MLModelsIndex(BaseModel): | ||
model_id: int | ||
filename: str | ||
target_me: str | ||
active: bool | ||
|
||
|
||
class PaginatedMLModelsIndexList(PaginatedBaseModel): | ||
next: Optional[AnyUrl] | ||
previous: Optional[AnyUrl] | ||
results: list[MLModelsIndex] | ||
|
||
|
||
class MLModelsIndexFilters(OBaseModel): | ||
next_token: Optional[str] = None | ||
page_size: Optional[int] = None | ||
model_id: Optional[int] = None | ||
model_id__in: Optional[list[int]] = None | ||
filename: Optional[str] = None | ||
filename__regex: Optional[str] = None | ||
target_me: Optional[str] = None | ||
target_me__regex: Optional[str] = None | ||
active: Optional[bool] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters