Skip to content

Commit 73703c9

Browse files
committed
chore: update models and api spec
1 parent 0174e5b commit 73703c9

File tree

6 files changed

+67
-20
lines changed

6 files changed

+67
-20
lines changed

cryosparc/api.pyi

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from .models.api_response import (
1717
)
1818
from .models.asset import GridFSAsset, GridFSFile
1919
from .models.auth import Token
20+
from .models.config import SystemInfo
2021
from .models.diagnostics import RuntimeDiagnostics
2122
from .models.event import CheckpointEvent, Event, ImageEvent, InteractiveEvent, TextEvent
2223
from .models.exposure import Exposure
@@ -29,7 +30,7 @@ from .models.notification import Notification
2930
from .models.project import GenerateIntermediateResultsSettings, Project, ProjectSymlink
3031
from .models.scheduler_lane import SchedulerLane
3132
from .models.scheduler_target import Cluster, Node, SchedulerTarget
32-
from .models.service import LoggingService, ServiceLogLevel
33+
from .models.services import LoggingService
3334
from .models.session import (
3435
DataManagementStats,
3536
ExposureGroup,
@@ -56,8 +57,14 @@ class APINamespace:
5657

5758
class ConfigNamespace(APINamespace):
5859
"""
59-
Methods available in api.config, e.g., api.config.get_instance_uid(...)
60+
Methods available in api.config, e.g., api.config.set_instance_banner(...)
6061
"""
62+
def set_instance_banner(
63+
self, *, active: bool = False, title: Optional[str] = ..., body: Optional[str] = ...
64+
) -> Any: ...
65+
def set_login_message(
66+
self, *, active: bool = False, title: Optional[str] = ..., body: Optional[str] = ...
67+
) -> Any: ...
6168
def get_instance_uid(self) -> str:
6269
"""
6370
Gets this CryoSPARC instance's unique UID.
@@ -80,7 +87,7 @@ class ConfigNamespace(APINamespace):
8087
Gets the current CryoSPARC version (with patch suffix, if available)
8188
"""
8289
...
83-
def get_system_info(self) -> Dict[str, Any]:
90+
def get_system_info(self) -> SystemInfo:
8491
"""
8592
System information related to the CryoSPARC application
8693
"""
@@ -140,16 +147,7 @@ class InstanceNamespace(APINamespace):
140147
"""
141148
...
142149
def get_service_log(
143-
self,
144-
service: LoggingService,
145-
/,
146-
*,
147-
days: int = 7,
148-
date: Optional[str] = ...,
149-
log_name: str = "",
150-
func_name: str = "",
151-
level: Optional[ServiceLogLevel] = ...,
152-
max_lines: Optional[int] = ...,
150+
self, service: LoggingService, /, *, days: int = 30, date: Optional[str] = ..., max_lines: Optional[int] = ...
153151
) -> str:
154152
"""
155153
Gets cryosparc service logs, filterable by date, name, function, and level
@@ -160,6 +158,7 @@ class InstanceNamespace(APINamespace):
160158
Gets runtime diagnostics for the CryoSPARC instance
161159
"""
162160
...
161+
def audit_dump(self) -> str | None: ...
163162

164163
class CacheNamespace(APINamespace):
165164
"""
@@ -797,7 +796,7 @@ class JobsNamespace(APINamespace):
797796
Adds the job to the queue for the given worker lane (default lane if not specified)
798797
"""
799798
...
800-
def recalculate_intermediate_results_size(self, project_uid: str, job_uid: str, /) -> Any:
799+
def recalculate_size_async(self, project_uid: str, job_uid: str, /) -> Any:
801800
"""
802801
For a job, find intermediate results and recalculate their total size.
803802
"""
@@ -2337,7 +2336,7 @@ class DeveloperNamespace(APINamespace):
23372336
class APIClient:
23382337
"""
23392338
Top-level API client class. e.g., ``api.read_root(...)``
2340-
or ``api.config.get_instance_uid(...)``
2339+
or ``api.config.set_instance_banner(...)``
23412340
"""
23422341

23432342
config: ConfigNamespace

cryosparc/model_registry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
api_response,
66
asset,
77
auth,
8+
config,
89
diagnostics,
910
event,
1011
exposure,
@@ -20,7 +21,7 @@
2021
project,
2122
scheduler_lane,
2223
scheduler_target,
23-
service,
24+
services,
2425
session,
2526
session_config_profile,
2627
session_params,
@@ -54,11 +55,12 @@
5455
register_model_module(when)
5556
register_model_module(params)
5657
register_model_module(license)
57-
register_model_module(service)
58+
register_model_module(services)
5859
register_model_module(notification)
5960
register_model_module(diagnostics)
6061
register_model_module(scheduler_lane)
6162
register_model_module(session_spec)
6263
register_model_module(session_config_profile)
64+
register_model_module(config)
6365
register_model_module(tag)
6466
register_model_module(auth)

cryosparc/models/config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
2+
# SEE dev/api_generate_models.py
3+
from pydantic import BaseModel
4+
5+
6+
class SystemInfo(BaseModel):
7+
version: str
8+
master_hostname: str
9+
port_app: int
10+
port_mongo: int
11+
port_api: int
12+
port_command_vis: int
13+
port_rtp_webapp: int
14+
is_db_auth_enabled: bool

cryosparc/models/services.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
2+
# SEE dev/api_generate_models.py
3+
from typing import Literal
4+
5+
LoggingService = Literal["app", "database", "cache", "api", "scheduler", "command_vis", "app_api", "supervisord"]
6+
"""
7+
Same as Service, but also includes supervisord.
8+
"""

cryosparc/models/session_params.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
22
# SEE dev/api_generate_models.py
3-
from typing import Literal, Optional
3+
from typing import TYPE_CHECKING, Any, Literal, Optional
44

5-
from pydantic import BaseModel
5+
from pydantic import BaseModel, ConfigDict
66

77

88
class LivePreprocessingParams(BaseModel):
@@ -75,12 +75,24 @@ class LivePreprocessingParams(BaseModel):
7575
extract_f16: bool = False
7676
do_plotting: bool = False
7777

78+
model_config = ConfigDict(extra="allow")
79+
if TYPE_CHECKING:
80+
81+
def __init__(self, **kwargs: Any) -> None: ...
82+
def __getattr__(self, key: str) -> Any: ...
83+
7884

7985
class LiveAbinitParams(BaseModel):
8086
abinit_symmetry: str = "C1"
8187
abinit_K: int = 1
8288
abinit_num_particles: Optional[int] = None
8389

90+
model_config = ConfigDict(extra="allow")
91+
if TYPE_CHECKING:
92+
93+
def __init__(self, **kwargs: Any) -> None: ...
94+
def __getattr__(self, key: str) -> Any: ...
95+
8496

8597
class LiveClass2DParams(BaseModel):
8698
class2D_K: int = 50
@@ -89,7 +101,19 @@ class LiveClass2DParams(BaseModel):
89101
compute_use_ssd: bool = True
90102
psize_mic: Optional[float] = None
91103

104+
model_config = ConfigDict(extra="allow")
105+
if TYPE_CHECKING:
106+
107+
def __init__(self, **kwargs: Any) -> None: ...
108+
def __getattr__(self, key: str) -> Any: ...
109+
92110

93111
class LiveRefineParams(BaseModel):
94112
refine_symmetry: str = "C1"
95113
psize_mic: Optional[float] = None
114+
115+
model_config = ConfigDict(extra="allow")
116+
if TYPE_CHECKING:
117+
118+
def __init__(self, **kwargs: Any) -> None: ...
119+
def __getattr__(self, key: str) -> Any: ...

cryosparc/models/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class User(BaseModel):
8585
id: str = Field("000000000000000000000000", alias="_id")
8686
updated_at: datetime.datetime = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
8787
created_at: datetime.datetime = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
88-
emails: List[Email]
88+
emails: List[Email] = []
8989
created_by_user_id: Optional[str] = None
9090
name: str
9191
first_name: str

0 commit comments

Comments
 (0)