Zen Server
zenml.zen_server
ZenML Server Implementation.
The ZenML Server is a centralized service meant for use in a collaborative setting in which stacks, stack components, flavors, pipeline and pipeline runs can be shared over the network with other users.
You can use the zenml server up
command to spin up ZenML server instances
that are either running locally as daemon processes or docker containers, or
to deploy a ZenML server remotely on a managed cloud platform. The other CLI
commands in the same zenml server
group can be used to manage the server
instances deployed from your local machine.
To connect the local ZenML client to one of the managed ZenML servers, call
zenml server connect
with the name of the server you want to connect to.
Modules
auth
Authentication module for ZenML server.
Classes
AuthContext
Bases: BaseModel
The authentication context.
CookieOAuth2TokenBearer
Bases: OAuth2PasswordBearer
OAuth2 token bearer authentication scheme that uses a cookie.
Functions
authenticate_api_key(api_key: str) -> AuthContext
Implement service account API key authentication.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key
|
str
|
The service account API key. |
required |
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context reflecting the authenticated service account. |
Raises:
Type | Description |
---|---|
CredentialsNotValid
|
If the service account could not be authorized. |
Source code in src/zenml/zen_server/auth.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
|
authenticate_credentials(user_name_or_id: Optional[Union[str, UUID]] = None, password: Optional[str] = None, access_token: Optional[str] = None, csrf_token: Optional[str] = None, activation_token: Optional[str] = None) -> AuthContext
Verify if user authentication credentials are valid.
This function can be used to validate all supplied user credentials to cover a range of possibilities:
- username only - only when the no-auth scheme is used
- username+password - for basic HTTP authentication or the OAuth2 password grant
- access token (with embedded user id) - after successful authentication using one of the supported grants
- username+activation token - for user activation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Optional[Union[str, UUID]]
|
The username or user ID. |
None
|
password
|
Optional[str]
|
The password. |
None
|
access_token
|
Optional[str]
|
The access token. |
None
|
csrf_token
|
Optional[str]
|
The CSRF token. |
None
|
activation_token
|
Optional[str]
|
The activation token. |
None
|
Returns:
Type | Description |
---|---|
AuthContext
|
The authenticated account details. |
Raises:
Type | Description |
---|---|
CredentialsNotValid
|
If the credentials are invalid. |
Source code in src/zenml/zen_server/auth.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
|
authenticate_device(client_id: UUID, device_code: str) -> AuthContext
Verify if device authorization credentials are valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_id
|
UUID
|
The OAuth2 client ID. |
required |
device_code
|
str
|
The device code. |
required |
Returns:
Type | Description |
---|---|
AuthContext
|
The authenticated account details. |
Raises:
Type | Description |
---|---|
OAuthError
|
If the device authorization credentials are invalid. |
Source code in src/zenml/zen_server/auth.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
authenticate_external_user(external_access_token: str, request: Request) -> AuthContext
Implement external authentication.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
external_access_token
|
str
|
The access token used to authenticate the user to the external authenticator. |
required |
request
|
Request
|
The request object. |
required |
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context reflecting the authenticated user. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
If the external user could not be authorized. |
Source code in src/zenml/zen_server/auth.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
|
authentication_provider() -> Callable[..., AuthContext]
Returns the authentication provider.
Returns:
Type | Description |
---|---|
Callable[..., AuthContext]
|
The authentication provider. |
Raises:
Type | Description |
---|---|
ValueError
|
If the authentication scheme is not supported. |
Source code in src/zenml/zen_server/auth.py
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
|
generate_access_token(user_id: UUID, response: Optional[Response] = None, request: Optional[Request] = None, device: Optional[OAuthDeviceInternalResponse] = None, api_key: Optional[APIKeyInternalResponse] = None, expires_in: Optional[int] = None, schedule_id: Optional[UUID] = None, pipeline_run_id: Optional[UUID] = None, step_run_id: Optional[UUID] = None) -> OAuthTokenResponse
Generates an access token for the given user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id
|
UUID
|
The ID of the user. |
required |
response
|
Optional[Response]
|
The FastAPI response object. If passed, the access token will also be set as an HTTP only cookie in the response. |
None
|
request
|
Optional[Request]
|
The FastAPI request object. Used to determine the request origin and to decide whether to use cross-site security measures for the access token cookie. |
None
|
device
|
Optional[OAuthDeviceInternalResponse]
|
The device used for authentication. |
None
|
api_key
|
Optional[APIKeyInternalResponse]
|
The service account API key used for authentication. |
None
|
expires_in
|
Optional[int]
|
The number of seconds until the token expires. If not set, the default value is determined automatically based on the server configuration and type of token. If set to 0, the token will not expire. |
None
|
schedule_id
|
Optional[UUID]
|
The ID of the schedule to scope the token to. |
None
|
pipeline_run_id
|
Optional[UUID]
|
The ID of the pipeline run to scope the token to. |
None
|
step_run_id
|
Optional[UUID]
|
The ID of the step run to scope the token to. |
None
|
Returns:
Type | Description |
---|---|
OAuthTokenResponse
|
An authentication response with an access token. |
Source code in src/zenml/zen_server/auth.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 |
|
get_auth_context() -> Optional[AuthContext]
Returns the current authentication context.
Returns:
Type | Description |
---|---|
Optional[AuthContext]
|
The authentication context. |
Source code in src/zenml/zen_server/auth.py
85 86 87 88 89 90 91 92 |
|
http_authentication(credentials: HTTPBasicCredentials = Depends(HTTPBasic())) -> AuthContext
Authenticates any request to the ZenML Server with basic HTTP authentication.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials
|
HTTPBasicCredentials
|
HTTP basic auth credentials passed to the request. |
Depends(HTTPBasic())
|
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context reflecting the authenticated user. |
noqa: DAR401
Source code in src/zenml/zen_server/auth.py
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
|
no_authentication() -> AuthContext
Doesn't authenticate requests to the ZenML server.
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context reflecting the default user. |
Source code in src/zenml/zen_server/auth.py
1072 1073 1074 1075 1076 1077 1078 |
|
oauth2_authentication(request: Request, token: str = Depends(CookieOAuth2TokenBearer(tokenUrl=server_config().root_url_path + API + VERSION_1 + LOGIN))) -> AuthContext
Authenticates any request to the ZenML server with OAuth2 JWT tokens.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
The JWT bearer token to be authenticated. |
Depends(CookieOAuth2TokenBearer(tokenUrl=root_url_path + API + VERSION_1 + LOGIN))
|
request
|
Request
|
The FastAPI request object. |
required |
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context reflecting the authenticated user. |
noqa: DAR401
Source code in src/zenml/zen_server/auth.py
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
|
set_auth_context(auth_context: AuthContext) -> AuthContext
Sets the current authentication context.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth_context
|
AuthContext
|
The authentication context. |
required |
Returns:
Type | Description |
---|---|
AuthContext
|
The authentication context. |
Source code in src/zenml/zen_server/auth.py
95 96 97 98 99 100 101 102 103 104 105 |
|
cache
Memory cache module for the ZenML server.
Classes
MemoryCache(max_capacity: int, default_expiry: int)
Simple in-memory cache with expiry and capacity management.
This cache is thread-safe and can be used in both synchronous and asynchronous contexts. It uses a simple LRU (Least Recently Used) eviction strategy to manage the cache size.
Each cache entry has a key, value, timestamp, and expiry. The cache automatically removes expired entries and evicts the oldest entry when the cache reaches its maximum capacity.
Usage Example:
cache = MemoryCache()
uuid_key = UUID("12345678123456781234567812345678")
if not cache.get(uuid_key):
# Get the value from the database or other source
value = get_value_from_database()
cache.set(uuid_key, value, expiry=60)
Usage Example with decorator:
@cache_result(expiry=60)
def get_cached_value(key: UUID) -> Any:
return get_value_from_database(key)
uuid_key = UUID("12345678123456781234567812345678")
value = get_cached_value(uuid_key)
Initialize the cache with a maximum capacity and default expiry time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_capacity
|
int
|
The maximum number of entries the cache can hold. |
required |
default_expiry
|
int
|
The default expiry time in seconds. |
required |
Source code in src/zenml/zen_server/cache.py
86 87 88 89 90 91 92 93 94 95 96 |
|
get(key: UUID) -> Optional[Any]
Retrieve value if it's still valid; otherwise, return None.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
UUID
|
The key to retrieve the value for. |
required |
Returns:
Type | Description |
---|---|
Optional[Any]
|
The value if it's still valid; otherwise, None. |
Source code in src/zenml/zen_server/cache.py
112 113 114 115 116 117 118 119 120 121 122 |
|
set(key: UUID, value: Any, expiry: Optional[int] = None) -> None
Insert value into cache with optional custom expiry time in seconds.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
UUID
|
The key to insert the value with. |
required |
value
|
Any
|
The value to insert into the cache. |
required |
expiry
|
Optional[int]
|
The expiry time in seconds. If None, uses the default expiry. |
None
|
Source code in src/zenml/zen_server/cache.py
98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
MemoryCacheEntry(value: Any, expiry: int)
Simple class to hold cache entry data.
Initialize a cache entry with value and expiry time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Any
|
The value to store in the cache. |
required |
expiry
|
int
|
The expiry time in seconds. |
required |
Source code in src/zenml/zen_server/cache.py
32 33 34 35 36 37 38 39 40 41 |
|
expired: bool
property
Check if the cache entry has expired.
Returns:
Type | Description |
---|---|
bool
|
True if the cache entry has expired; otherwise, False. |
Functions
cache_result(expiry: Optional[int] = None) -> Callable[[F], F]
A decorator to cache the result of a function based on a UUID key argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expiry
|
Optional[int]
|
Custom time in seconds for the cache entry to expire. If None, uses the default expiry time. |
None
|
Returns:
Type | Description |
---|---|
Callable[[F], F]
|
A decorator that wraps a function, caching its results based on a UUID |
Callable[[F], F]
|
key. |
Source code in src/zenml/zen_server/cache.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
cloud_utils
Utils concerning anything concerning the cloud control plane backend.
Classes
ZenMLCloudConnection()
Class to use for communication between server and control plane.
Initialize the RBAC component.
Source code in src/zenml/zen_server/cloud_utils.py
20 21 22 23 24 25 |
|
session: requests.Session
property
Authenticate to the ZenML Pro Management Plane.
Returns:
Type | Description |
---|---|
Session
|
A requests session with the authentication token. |
delete(endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) -> requests.Response
Send a DELETE request using the active session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to send the request to. This will be appended to the base URL. |
required |
params
|
Optional[Dict[str, Any]]
|
Parameters to include in the request. |
None
|
data
|
Optional[Dict[str, Any]]
|
Data to include in the request. |
None
|
Returns:
Type | Description |
---|---|
Response
|
The response. |
Source code in src/zenml/zen_server/cloud_utils.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
get(endpoint: str, params: Optional[Dict[str, Any]]) -> requests.Response
Send a GET request using the active session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to send the request to. This will be appended to the base URL. |
required |
params
|
Optional[Dict[str, Any]]
|
Parameters to include in the request. |
required |
Returns:
Type | Description |
---|---|
Response
|
The response. |
Source code in src/zenml/zen_server/cloud_utils.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
patch(endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) -> requests.Response
Send a PATCH request using the active session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to send the request to. This will be appended to the base URL. |
required |
params
|
Optional[Dict[str, Any]]
|
Parameters to include in the request. |
None
|
data
|
Optional[Dict[str, Any]]
|
Data to include in the request. |
None
|
Returns:
Type | Description |
---|---|
Response
|
The response. |
Source code in src/zenml/zen_server/cloud_utils.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
post(endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) -> requests.Response
Send a POST request using the active session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to send the request to. This will be appended to the base URL. |
required |
params
|
Optional[Dict[str, Any]]
|
Parameters to include in the request. |
None
|
data
|
Optional[Dict[str, Any]]
|
Data to include in the request. |
None
|
Returns:
Type | Description |
---|---|
Response
|
The response. |
Source code in src/zenml/zen_server/cloud_utils.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
request(method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) -> requests.Response
Send a request using the active session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
str
|
The HTTP method to use. |
required |
endpoint
|
str
|
The endpoint to send the request to. This will be appended to the base URL. |
required |
params
|
Optional[Dict[str, Any]]
|
Parameters to include in the request. |
None
|
data
|
Optional[Dict[str, Any]]
|
Data to include in the request. |
None
|
Raises:
Type | Description |
---|---|
SubscriptionUpgradeRequiredError
|
If the current subscription tier is insufficient for the attempted operation. |
RuntimeError
|
If the request failed. |
Returns:
Type | Description |
---|---|
Response
|
The response. |
Source code in src/zenml/zen_server/cloud_utils.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
Functions
cloud_connection() -> ZenMLCloudConnection
Return the initialized cloud connection.
Returns:
Type | Description |
---|---|
ZenMLCloudConnection
|
The cloud connection. |
Source code in src/zenml/zen_server/cloud_utils.py
257 258 259 260 261 262 263 264 265 266 267 |
|
send_pro_workspace_status_update() -> None
Send a workspace status update to the Cloud API.
Source code in src/zenml/zen_server/cloud_utils.py
270 271 272 |
|
csrf
CSRF token utilities module for ZenML server.
Classes
CSRFToken
Bases: BaseModel
Pydantic object representing a CSRF token.
Attributes:
Name | Type | Description |
---|---|---|
session_id |
UUID
|
The id of the authenticated session. |
decode_token(token: str) -> CSRFToken
classmethod
Decodes a CSRF token.
Decodes a CSRF access token and returns a CSRFToken
object with the
information retrieved from its contents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
The encoded CSRF token. |
required |
Returns:
Type | Description |
---|---|
CSRFToken
|
The decoded CSRF token. |
Raises:
Type | Description |
---|---|
CredentialsNotValid
|
If the token is invalid. |
Source code in src/zenml/zen_server/csrf.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
encode() -> str
Creates a CSRF token.
Encodes, signs and returns a CSRF access token.
Returns:
Type | Description |
---|---|
str
|
The generated CSRF token. |
Source code in src/zenml/zen_server/csrf.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
Functions
deploy
ZenML server deployments.
Classes
LocalServerDeployer
Local server deployer singleton.
This class is responsible for managing the various server provider implementations and for directing server deployment lifecycle requests to the responsible provider. It acts as a facade built on top of the various server providers.
connect_to_server() -> None
Connect to the local ZenML server instance.
Raises:
Type | Description |
---|---|
ServerDeploymentError
|
If the local ZenML server is not running or is unreachable. |
Source code in src/zenml/zen_server/deploy/deployer.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
deploy_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None, restart: bool = False) -> LocalServerDeployment
Deploy the local ZenML server or update the existing deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successful. If not supplied, the default timeout value specified by the provider is used. |
None
|
restart
|
bool
|
If True, the existing server deployment will be torn down and a new server will be deployed. |
False
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The local server deployment. |
Source code in src/zenml/zen_server/deploy/deployer.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
disconnect_from_server() -> None
Disconnect from the ZenML server instance.
Source code in src/zenml/zen_server/deploy/deployer.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
get_provider(provider_type: ServerProviderType) -> BaseServerProvider
classmethod
Get the server provider associated with a provider type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider_type
|
ServerProviderType
|
The server provider type. |
required |
Returns:
Type | Description |
---|---|
BaseServerProvider
|
The server provider associated with the provider type. |
Raises:
Type | Description |
---|---|
ServerProviderNotFoundError
|
If no provider is registered for the given provider type. |
Source code in src/zenml/zen_server/deploy/deployer.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
get_server() -> LocalServerDeployment
Get the local server deployment.
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The local server deployment. |
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If no local server deployment is found. |
Source code in src/zenml/zen_server/deploy/deployer.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
get_server_logs(follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Retrieve the logs for the local ZenML server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
follow
|
bool
|
if True, the logs will be streamed as they are written |
False
|
tail
|
Optional[int]
|
only retrieve the last NUM lines of log output. |
None
|
Returns:
Type | Description |
---|---|
None
|
A generator that can be accessed to get the service logs. |
Source code in src/zenml/zen_server/deploy/deployer.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
initialize_local_database() -> None
Initialize the local ZenML database.
Source code in src/zenml/zen_server/deploy/deployer.py
88 89 90 91 |
|
is_connected_to_server() -> bool
Check if the ZenML client is currently connected to the local ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if the ZenML client is connected to the local ZenML server, False |
bool
|
otherwise. |
Source code in src/zenml/zen_server/deploy/deployer.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
register_provider(provider: Type[BaseServerProvider]) -> None
classmethod
Register a server provider.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider
|
Type[BaseServerProvider]
|
The server provider to register. |
required |
Raises:
Type | Description |
---|---|
TypeError
|
If a provider with the same type is already registered. |
Source code in src/zenml/zen_server/deploy/deployer.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
remove_server(timeout: Optional[int] = None) -> None
Tears down and removes all resources and files associated with the local ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successfully torn down. If not supplied, a provider specific default timeout value is used. |
None
|
Source code in src/zenml/zen_server/deploy/deployer.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
update_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None, restart: bool = False) -> LocalServerDeployment
Update an existing local ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The new server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successful. If not supplied, a default timeout value of 30 seconds is used. |
None
|
restart
|
bool
|
If True, the existing server deployment will be torn down and a new server will be deployed. |
False
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The updated server deployment. |
Source code in src/zenml/zen_server/deploy/deployer.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
LocalServerDeployment
Bases: BaseModel
Server deployment.
Attributes:
Name | Type | Description |
---|---|---|
config |
LocalServerDeploymentConfig
|
The server deployment configuration. |
status |
Optional[LocalServerDeploymentStatus]
|
The server deployment status. |
is_running: bool
property
Check if the server is running.
Returns:
Type | Description |
---|---|
bool
|
Whether the server is running. |
LocalServerDeploymentConfig
Bases: BaseModel
Generic local server deployment configuration.
All local server deployment configurations should inherit from this class and handle extra attributes as provider specific attributes.
Attributes:
Name | Type | Description |
---|---|---|
provider |
ServerProviderType
|
The server provider type. |
url: Optional[str]
property
Get the configured server URL.
Returns:
Type | Description |
---|---|
Optional[str]
|
The configured server URL. |
Modules
base_provider
Base ZenML server provider class.
BaseServerProvider
Bases: ABC
Base ZenML server provider class.
All ZenML server providers must extend and implement this base class.
deploy_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None) -> LocalServerDeployment
Deploy a new ZenML server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The generic server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successful. If not supplied, the default timeout value specified by the provider is used. |
None
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The newly created server deployment. |
Raises:
Type | Description |
---|---|
ServerDeploymentExistsError
|
If a deployment already exists. |
Source code in src/zenml/zen_server/deploy/base_provider.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
get_server(config: LocalServerDeploymentConfig) -> LocalServerDeployment
Retrieve information about a ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The generic server deployment configuration. |
required |
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The server deployment. |
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If a deployment doesn't exist. |
Source code in src/zenml/zen_server/deploy/base_provider.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
get_server_logs(config: LocalServerDeploymentConfig, follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Retrieve the logs of a ZenML server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The generic server deployment configuration. |
required |
follow
|
bool
|
if True, the logs will be streamed as they are written |
False
|
tail
|
Optional[int]
|
only retrieve the last NUM lines of log output. |
None
|
Returns:
Type | Description |
---|---|
None
|
A generator that can be accessed to get the service logs. |
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If a deployment doesn't exist. |
Source code in src/zenml/zen_server/deploy/base_provider.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
register_as_provider() -> None
classmethod
Register the class as a server provider.
Source code in src/zenml/zen_server/deploy/base_provider.py
55 56 57 58 59 60 |
|
remove_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None) -> None
Tears down and removes all resources and files associated with a ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The generic server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the server is removed. If not supplied, the default timeout value specified by the provider is used. |
None
|
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If a deployment doesn't exist. |
Source code in src/zenml/zen_server/deploy/base_provider.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
update_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None) -> LocalServerDeployment
Update an existing ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The new generic server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the update is successful. If not supplied, the default timeout value specified by the provider is used. |
None
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The updated server deployment. |
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If a deployment doesn't exist. |
Source code in src/zenml/zen_server/deploy/base_provider.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
daemon
ZenML Server Local Daemon Deployment.
DaemonServerProvider
Bases: BaseServerProvider
Daemon ZenML server provider.
check_local_server_dependencies() -> None
staticmethod
Check if local server dependencies are installed.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the dependencies are not installed. |
Source code in src/zenml/zen_server/deploy/daemon/daemon_provider.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
daemon_provider
Zen Server daemon provider implementation.
DaemonServerProvider
Bases: BaseServerProvider
Daemon ZenML server provider.
check_local_server_dependencies() -> None
staticmethod
Check if local server dependencies are installed.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the dependencies are not installed. |
Source code in src/zenml/zen_server/deploy/daemon/daemon_provider.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
daemon_zen_server
Local daemon ZenML server deployment service implementation.
DaemonServerDeploymentConfig
Bases: LocalServerDeploymentConfig
Daemon server deployment configuration.
Attributes:
Name | Type | Description |
---|---|---|
port |
int
|
The TCP port number where the server is accepting connections. |
address |
int
|
The IP address where the server is reachable. |
blocking |
bool
|
Run the server in blocking mode instead of using a daemon process. |
url: Optional[str]
property
Get the configured server URL.
Returns:
Type | Description |
---|---|
Optional[str]
|
The configured server URL. |
DaemonZenServer(**attrs: Any)
Bases: LocalDaemonService
Service daemon that can be used to start a local daemon ZenML server.
Attributes:
Name | Type | Description |
---|---|---|
config |
DaemonZenServerConfig
|
service configuration |
endpoint |
LocalDaemonServiceEndpoint
|
optional service endpoint |
Source code in src/zenml/services/service.py
188 189 190 191 192 193 194 195 196 197 198 |
|
config_path() -> str
classmethod
Path to the directory where the local daemon ZenML server files are located.
Returns:
Type | Description |
---|---|
str
|
Path to the local daemon ZenML server runtime directory. |
Source code in src/zenml/zen_server/deploy/daemon/daemon_zen_server.py
114 115 116 117 118 119 120 121 122 123 124 125 |
|
get_service() -> Optional[DaemonZenServer]
classmethod
Load and return the local daemon ZenML server service, if present.
Returns:
Type | Description |
---|---|
Optional[DaemonZenServer]
|
The local daemon ZenML server service or None, if the local server |
Optional[DaemonZenServer]
|
deployment is not found. |
Source code in src/zenml/zen_server/deploy/daemon/daemon_zen_server.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
provision() -> None
Provision the service.
Source code in src/zenml/zen_server/deploy/daemon/daemon_zen_server.py
184 185 186 |
|
run() -> None
Run the ZenML Server.
Raises:
Type | Description |
---|---|
ValueError
|
if started with a global configuration that connects to another ZenML server. |
Source code in src/zenml/zen_server/deploy/daemon/daemon_zen_server.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
start(timeout: int = 0) -> None
Start the service and optionally wait for it to become active.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
int
|
amount of time to wait for the service to become active. If set to 0, the method will return immediately after checking the service status. |
0
|
Source code in src/zenml/zen_server/deploy/daemon/daemon_zen_server.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
DaemonZenServerConfig(**data: Any)
Bases: LocalDaemonServiceConfig
Local daemon Zen server configuration.
Attributes:
Name | Type | Description |
---|---|---|
server |
DaemonServerDeploymentConfig
|
The deployment configuration. |
Source code in src/zenml/services/service.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
deployer
ZenML server deployer singleton implementation.
LocalServerDeployer
Local server deployer singleton.
This class is responsible for managing the various server provider implementations and for directing server deployment lifecycle requests to the responsible provider. It acts as a facade built on top of the various server providers.
connect_to_server() -> None
Connect to the local ZenML server instance.
Raises:
Type | Description |
---|---|
ServerDeploymentError
|
If the local ZenML server is not running or is unreachable. |
Source code in src/zenml/zen_server/deploy/deployer.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
deploy_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None, restart: bool = False) -> LocalServerDeployment
Deploy the local ZenML server or update the existing deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successful. If not supplied, the default timeout value specified by the provider is used. |
None
|
restart
|
bool
|
If True, the existing server deployment will be torn down and a new server will be deployed. |
False
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The local server deployment. |
Source code in src/zenml/zen_server/deploy/deployer.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
disconnect_from_server() -> None
Disconnect from the ZenML server instance.
Source code in src/zenml/zen_server/deploy/deployer.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
get_provider(provider_type: ServerProviderType) -> BaseServerProvider
classmethod
Get the server provider associated with a provider type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider_type
|
ServerProviderType
|
The server provider type. |
required |
Returns:
Type | Description |
---|---|
BaseServerProvider
|
The server provider associated with the provider type. |
Raises:
Type | Description |
---|---|
ServerProviderNotFoundError
|
If no provider is registered for the given provider type. |
Source code in src/zenml/zen_server/deploy/deployer.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
get_server() -> LocalServerDeployment
Get the local server deployment.
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The local server deployment. |
Raises:
Type | Description |
---|---|
ServerDeploymentNotFoundError
|
If no local server deployment is found. |
Source code in src/zenml/zen_server/deploy/deployer.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
get_server_logs(follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Retrieve the logs for the local ZenML server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
follow
|
bool
|
if True, the logs will be streamed as they are written |
False
|
tail
|
Optional[int]
|
only retrieve the last NUM lines of log output. |
None
|
Returns:
Type | Description |
---|---|
None
|
A generator that can be accessed to get the service logs. |
Source code in src/zenml/zen_server/deploy/deployer.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
initialize_local_database() -> None
Initialize the local ZenML database.
Source code in src/zenml/zen_server/deploy/deployer.py
88 89 90 91 |
|
is_connected_to_server() -> bool
Check if the ZenML client is currently connected to the local ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if the ZenML client is connected to the local ZenML server, False |
bool
|
otherwise. |
Source code in src/zenml/zen_server/deploy/deployer.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
register_provider(provider: Type[BaseServerProvider]) -> None
classmethod
Register a server provider.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider
|
Type[BaseServerProvider]
|
The server provider to register. |
required |
Raises:
Type | Description |
---|---|
TypeError
|
If a provider with the same type is already registered. |
Source code in src/zenml/zen_server/deploy/deployer.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
remove_server(timeout: Optional[int] = None) -> None
Tears down and removes all resources and files associated with the local ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successfully torn down. If not supplied, a provider specific default timeout value is used. |
None
|
Source code in src/zenml/zen_server/deploy/deployer.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
update_server(config: LocalServerDeploymentConfig, timeout: Optional[int] = None, restart: bool = False) -> LocalServerDeployment
Update an existing local ZenML server deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
LocalServerDeploymentConfig
|
The new server deployment configuration. |
required |
timeout
|
Optional[int]
|
The timeout in seconds to wait until the deployment is successful. If not supplied, a default timeout value of 30 seconds is used. |
None
|
restart
|
bool
|
If True, the existing server deployment will be torn down and a new server will be deployed. |
False
|
Returns:
Type | Description |
---|---|
LocalServerDeployment
|
The updated server deployment. |
Source code in src/zenml/zen_server/deploy/deployer.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
deployment
Zen Server deployment definitions.
LocalServerDeployment
Bases: BaseModel
Server deployment.
Attributes:
Name | Type | Description |
---|---|---|
config |
LocalServerDeploymentConfig
|
The server deployment configuration. |
status |
Optional[LocalServerDeploymentStatus]
|
The server deployment status. |
is_running: bool
property
Check if the server is running.
Returns:
Type | Description |
---|---|
bool
|
Whether the server is running. |
LocalServerDeploymentConfig
Bases: BaseModel
Generic local server deployment configuration.
All local server deployment configurations should inherit from this class and handle extra attributes as provider specific attributes.
Attributes:
Name | Type | Description |
---|---|---|
provider |
ServerProviderType
|
The server provider type. |
url: Optional[str]
property
Get the configured server URL.
Returns:
Type | Description |
---|---|
Optional[str]
|
The configured server URL. |
LocalServerDeploymentStatus
Bases: BaseModel
Local server deployment status.
Ideally this should convey the following information:
- whether the server's deployment is managed by this client (i.e. if
the server was deployed with
zenml login --local
) - for a managed deployment, the status of the deployment/tear-down, e.g. not deployed, deploying, running, deleting, deployment timeout/error, tear-down timeout/error etc.
- for an unmanaged deployment, the operational status (i.e. whether the server is reachable)
- the URL of the server
Attributes:
Name | Type | Description |
---|---|---|
status |
ServiceState
|
The status of the server deployment. |
status_message |
Optional[str]
|
A message describing the last status. |
connected |
bool
|
Whether the client is currently connected to this server. |
url |
Optional[str]
|
The URL of the server. |
docker
ZenML Server Docker Deployment.
DockerServerProvider
docker_provider
Zen Server docker deployer implementation.
docker_zen_server
Service implementation for the ZenML docker server deployment.
DockerServerDeploymentConfig
Bases: LocalServerDeploymentConfig
Docker server deployment configuration.
Attributes:
Name | Type | Description |
---|---|---|
port |
int
|
The TCP port number where the server is accepting connections. |
image |
str
|
The Docker image to use for the server. |
url: Optional[str]
property
Get the configured server URL.
Returns:
Type | Description |
---|---|
Optional[str]
|
The configured server URL. |
DockerZenServer(**attrs: Any)
Bases: ContainerService
Service that can be used to start a docker ZenServer.
Attributes:
Name | Type | Description |
---|---|---|
config |
DockerZenServerConfig
|
service configuration |
endpoint |
ContainerServiceEndpoint
|
service endpoint |
Source code in src/zenml/services/service.py
188 189 190 191 192 193 194 195 196 197 198 |
|
config_path() -> str
classmethod
Path to the directory where the docker ZenML server files are located.
Returns:
Type | Description |
---|---|
str
|
Path to the docker ZenML server runtime directory. |
Source code in src/zenml/zen_server/deploy/docker/docker_zen_server.py
116 117 118 119 120 121 122 123 124 125 126 127 |
|
get_service() -> Optional[DockerZenServer]
classmethod
Load and return the docker ZenML server service, if present.
Returns:
Type | Description |
---|---|
Optional[DockerZenServer]
|
The docker ZenML server service or None, if the docker server |
Optional[DockerZenServer]
|
deployment is not found. |
Source code in src/zenml/zen_server/deploy/docker/docker_zen_server.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
provision() -> None
Provision the service.
Source code in src/zenml/zen_server/deploy/docker/docker_zen_server.py
194 195 196 |
|
run() -> None
Run the ZenML Server.
Raises:
Type | Description |
---|---|
ValueError
|
if started with a global configuration that connects to another ZenML server. |
Source code in src/zenml/zen_server/deploy/docker/docker_zen_server.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
DockerZenServerConfig(**data: Any)
Bases: ContainerServiceConfig
Docker Zen server configuration.
Attributes:
Name | Type | Description |
---|---|---|
server |
DockerServerDeploymentConfig
|
The deployment configuration. |
Source code in src/zenml/services/service.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
exceptions
ZenML server deployment exceptions.
ServerDeploymentConfigurationError(message: Optional[str] = None, url: Optional[str] = None)
Bases: ServerDeploymentError
Raised when there is a ZenML server deployment configuration error .
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
ServerDeploymentError(message: Optional[str] = None, url: Optional[str] = None)
Bases: ZenMLBaseException
Base exception class for all ZenML server deployment related errors.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
ServerDeploymentExistsError(message: Optional[str] = None, url: Optional[str] = None)
Bases: ServerDeploymentError
Raised when trying to deploy a new ZenML server with the same name.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
ServerDeploymentNotFoundError(message: Optional[str] = None, url: Optional[str] = None)
Bases: ServerDeploymentError
Raised when trying to fetch a ZenML server deployment that doesn't exist.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
ServerProviderNotFoundError(message: Optional[str] = None, url: Optional[str] = None)
Bases: ServerDeploymentError
Raised when using a ZenML server provider that doesn't exist.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
exceptions
REST API exception handling.
Classes
ErrorModel
Bases: BaseModel
Base class for error responses.
Functions
error_detail(error: Exception, exception_type: Optional[Type[Exception]] = None) -> List[str]
Convert an Exception to API representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error
|
Exception
|
Exception to convert. |
required |
exception_type
|
Optional[Type[Exception]]
|
Exception type to use in the error response instead of the type of the supplied exception. This is useful when the raised exception is a subclass of an exception type that is properly handled by the REST API. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
List of strings representing the error. |
Source code in src/zenml/zen_server/exceptions.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
exception_from_response(response: requests.Response) -> Optional[Exception]
Convert an error HTTP response to an exception.
Uses the REST_API_EXCEPTIONS list to determine the appropriate exception class to use based on the response status code and the exception class name embedded in the response body.
The last entry in the list of exceptions associated with a status code is used as a fallback if the exception class name in the response body is not found in the list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
Response
|
HTTP error response to convert. |
required |
Returns:
Type | Description |
---|---|
Optional[Exception]
|
Exception with the appropriate type and arguments, or None if the |
Optional[Exception]
|
response does not contain an error or the response cannot be unpacked |
Optional[Exception]
|
into an exception. |
Source code in src/zenml/zen_server/exceptions.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
http_exception_from_error(error: Exception) -> HTTPException
Convert an Exception to a HTTP error response.
Uses the REST_API_EXCEPTIONS list to determine the appropriate status code associated with the exception type. The exception class name and arguments are embedded in the HTTP error response body.
The lookup uses the first occurrence of the exception type in the list. If
the exception type is not found in the list, the lookup uses isinstance
to determine the most specific exception type corresponding to the supplied
exception. This allows users to call this method with exception types that
are not directly listed in the REST_API_EXCEPTIONS list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error
|
Exception
|
Exception to convert. |
required |
Returns:
Type | Description |
---|---|
HTTPException
|
HTTPException with the appropriate status code and error detail. |
Source code in src/zenml/zen_server/exceptions.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
feature_gate
Modules
endpoint_utils
All endpoint utils for the feature gate implementations.
check_entitlement(resource_type: ResourceType) -> None
Queries the feature gate to see if the operation falls within the Pro workspaces entitlements.
Raises an exception if the user is not entitled to create an instance of the resource. Otherwise, simply returns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
ResourceType
|
The type of resource to check for. |
required |
Source code in src/zenml/zen_server/feature_gate/endpoint_utils.py
22 23 24 25 26 27 28 29 30 31 32 33 |
|
report_decrement(resource_type: ResourceType, resource_id: UUID) -> None
Reports the deletion/deactivation of a feature/resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
ResourceType
|
The type of resource to report a decrement in count for. |
required |
resource_id
|
UUID
|
ID of the resource that was deleted. |
required |
Source code in src/zenml/zen_server/feature_gate/endpoint_utils.py
50 51 52 53 54 55 56 57 58 59 60 61 |
|
report_usage(resource_type: ResourceType, resource_id: UUID) -> None
Reports the creation/usage of a feature/resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
ResourceType
|
The type of resource to report a usage for |
required |
resource_id
|
UUID
|
ID of the resource that was created. |
required |
Source code in src/zenml/zen_server/feature_gate/endpoint_utils.py
36 37 38 39 40 41 42 43 44 45 46 47 |
|
feature_gate_interface
Definition of the feature gate interface.
FeatureGateInterface
Bases: ABC
Feature gate interface definition.
check_entitlement(resource: ResourceType) -> None
abstractmethod
Checks if a user is entitled to create a resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource
|
ResourceType
|
The resource the user wants to create |
required |
Source code in src/zenml/zen_server/feature_gate/feature_gate_interface.py
25 26 27 28 29 30 31 32 33 34 |
|
report_event(resource: ResourceType, resource_id: UUID, is_decrement: bool = False) -> None
abstractmethod
Reports the usage of a feature to the aggregator backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource
|
ResourceType
|
The resource the user created |
required |
resource_id
|
UUID
|
ID of the resource that was created/deleted. |
required |
is_decrement
|
bool
|
In case this event reports an actual decrement of usage |
False
|
Source code in src/zenml/zen_server/feature_gate/feature_gate_interface.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
zenml_cloud_feature_gate
ZenML Pro implementation of the feature gate.
RawUsageEvent
Bases: BaseModel
Model for reporting raw usage of a feature.
In case of consumables the UsageReport allows the Pricing Backend to increment the usage per time-frame by 1.
ZenMLCloudFeatureGateInterface()
Bases: FeatureGateInterface
ZenML Cloud Feature Gate implementation.
Initialize the object.
Source code in src/zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py
65 66 67 |
|
check_entitlement(resource: ResourceType) -> None
Checks if a user is entitled to create a resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource
|
ResourceType
|
The resource the user wants to create |
required |
Raises:
Type | Description |
---|---|
SubscriptionUpgradeRequiredError
|
in case a subscription limit is reached |
Source code in src/zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
report_event(resource: ResourceType, resource_id: UUID, is_decrement: bool = False) -> None
Reports the usage of a feature to the aggregator backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource
|
ResourceType
|
The resource the user created |
required |
resource_id
|
UUID
|
ID of the resource that was created/deleted. |
required |
is_decrement
|
bool
|
In case this event reports an actual decrement of usage |
False
|
Source code in src/zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
jwt
JWT utilities module for ZenML server.
Classes
JWTToken
Bases: BaseModel
Pydantic object representing a JWT token.
Attributes:
Name | Type | Description |
---|---|---|
user_id |
UUID
|
The id of the authenticated User. |
device_id |
Optional[UUID]
|
The id of the authenticated device. |
api_key_id |
Optional[UUID]
|
The id of the authenticated API key for which this token was issued. |
schedule_id |
Optional[UUID]
|
The id of the schedule for which the token was issued. |
pipeline_run_id |
Optional[UUID]
|
The id of the pipeline run for which the token was issued. |
step_run_id |
Optional[UUID]
|
The id of the step run for which the token was issued. |
session_id |
Optional[UUID]
|
The id of the authenticated session (used for CSRF). |
claims |
Dict[str, Any]
|
The original token claims. |
decode_token(token: str, verify: bool = True) -> JWTToken
classmethod
Decodes a JWT access token.
Decodes a JWT access token and returns a JWTToken
object with the
information retrieved from its subject claim.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
str
|
The encoded JWT token. |
required |
verify
|
bool
|
Whether to verify the signature of the token. |
True
|
Returns:
Type | Description |
---|---|
JWTToken
|
The decoded JWT access token. |
Raises:
Type | Description |
---|---|
CredentialsNotValid
|
If the token is invalid. |
Source code in src/zenml/zen_server/jwt.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
encode(expires: Optional[datetime] = None) -> str
Creates a JWT access token.
Encodes, signs and returns a JWT access token.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expires
|
Optional[datetime]
|
Datetime after which the token will expire. If not provided, the JWT token will not be set to expire. |
None
|
Returns:
Type | Description |
---|---|
str
|
The generated access token. |
Source code in src/zenml/zen_server/jwt.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
Functions
rate_limit
Rate limiting for the ZenML Server.
Classes
RequestLimiter(day_limit: Optional[int] = None, minute_limit: Optional[int] = None)
Simple in-memory rate limiter.
Initializes the limiter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
day_limit
|
Optional[int]
|
The number of requests allowed per day. |
None
|
minute_limit
|
Optional[int]
|
The number of requests allowed per minute. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If both day_limit and minute_limit are None. |
Source code in src/zenml/zen_server/rate_limit.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
hit_limiter(request: Request) -> None
Increase the number of hits in the limiter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
Request object. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the request limit is exceeded. |
Source code in src/zenml/zen_server/rate_limit.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
limit_failed_requests(request: Request) -> Generator[None, Any, Any]
Limits the number of failed requests.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
Request object. |
required |
Yields:
Type | Description |
---|---|
None
|
None |
Source code in src/zenml/zen_server/rate_limit.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
reset_limiter(request: Request) -> None
Resets the limiter on successful request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
Request object. |
required |
Source code in src/zenml/zen_server/rate_limit.py
108 109 110 111 112 113 114 115 116 117 |
|
Functions
rate_limit_requests(day_limit: Optional[int] = None, minute_limit: Optional[int] = None) -> Callable[..., Any]
Decorator to handle exceptions in the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
day_limit
|
Optional[int]
|
Number of requests allowed per day. |
None
|
minute_limit
|
Optional[int]
|
Number of requests allowed per minute. |
None
|
Returns:
Type | Description |
---|---|
Callable[..., Any]
|
Decorated function. |
Source code in src/zenml/zen_server/rate_limit.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
rbac
RBAC definitions.
Modules
endpoint_utils
High-level helper functions to write endpoints with RBAC.
verify_permissions_and_batch_create_entity(batch: List[AnyRequest], create_method: Callable[[List[AnyRequest]], List[AnyResponse]]) -> List[AnyResponse]
Verify permissions and create a batch of entities if authorized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch
|
List[AnyRequest]
|
The batch to create. |
required |
create_method
|
Callable[[List[AnyRequest]], List[AnyResponse]]
|
The method to create the entities. |
required |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the resource type is usage-tracked. |
Returns:
Type | Description |
---|---|
List[AnyResponse]
|
The created entities. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
verify_permissions_and_create_entity(request_model: AnyRequest, create_method: Callable[[AnyRequest], AnyResponse], surrogate_models: Optional[List[AnyOtherResponse]] = None, skip_entitlements: bool = False) -> AnyResponse
Verify permissions and create the entity if authorized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_model
|
AnyRequest
|
The entity request model. |
required |
create_method
|
Callable[[AnyRequest], AnyResponse]
|
The method to create the entity. |
required |
surrogate_models
|
Optional[List[AnyOtherResponse]]
|
Optional list of surrogate models to verify UPDATE permissions for instead of verifying CREATE permissions for the request model. |
None
|
skip_entitlements
|
bool
|
Whether to skip the entitlement check and usage increment. |
False
|
Returns:
Type | Description |
---|---|
AnyResponse
|
A model of the created entity. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
verify_permissions_and_delete_entity(id: UUIDOrStr, get_method: Callable[[UUIDOrStr, bool], AnyResponse], delete_method: Callable[[UUIDOrStr], None], **delete_method_kwargs: Any) -> AnyResponse
Verify permissions and delete an entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
UUIDOrStr
|
The ID of the entity to delete. |
required |
get_method
|
Callable[[UUIDOrStr, bool], AnyResponse]
|
The method to fetch the entity. |
required |
delete_method
|
Callable[[UUIDOrStr], None]
|
The method to delete the entity. |
required |
delete_method_kwargs
|
Any
|
Keyword arguments to pass to the delete method. |
{}
|
Returns:
Type | Description |
---|---|
AnyResponse
|
The deleted entity. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
verify_permissions_and_get_entity(id: UUIDOrStr, get_method: Callable[[UUIDOrStr], AnyResponse], **get_method_kwargs: Any) -> AnyResponse
Verify permissions and fetch an entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
UUIDOrStr
|
The ID of the entity to fetch. |
required |
get_method
|
Callable[[UUIDOrStr], AnyResponse]
|
The method to fetch the entity. |
required |
get_method_kwargs
|
Any
|
Keyword arguments to pass to the get method. |
{}
|
Returns:
Type | Description |
---|---|
AnyResponse
|
A model of the fetched entity. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
verify_permissions_and_get_or_create_entity(request_model: AnyRequest, get_or_create_method: Callable[[AnyRequest, Optional[Callable[[], None]]], Tuple[AnyResponse, bool]]) -> Tuple[AnyResponse, bool]
Verify permissions and create the entity if authorized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_model
|
AnyRequest
|
The entity request model. |
required |
get_or_create_method
|
Callable[[AnyRequest, Optional[Callable[[], None]]], Tuple[AnyResponse, bool]]
|
The method to get or create the entity. |
required |
Returns:
Type | Description |
---|---|
Tuple[AnyResponse, bool]
|
The entity and a boolean indicating whether the entity was created. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
verify_permissions_and_list_entities(filter_model: AnyFilter, resource_type: ResourceType, list_method: Callable[[AnyFilter], Page[AnyResponse]], **list_method_kwargs: Any) -> Page[AnyResponse]
Verify permissions and list entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
AnyFilter
|
The entity filter model. |
required |
resource_type
|
ResourceType
|
The resource type of the entities to list. |
required |
list_method
|
Callable[[AnyFilter], Page[AnyResponse]]
|
The method to list the entities. |
required |
list_method_kwargs
|
Any
|
Keyword arguments to pass to the list method. |
{}
|
Returns:
Type | Description |
---|---|
Page[AnyResponse]
|
A page of entity models. |
Raises:
Type | Description |
---|---|
ValueError
|
If the filter's project scope is not set or is not a UUID. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
verify_permissions_and_prune_entities(resource_type: ResourceType, prune_method: Callable[..., None], project_id: Optional[UUID] = None, **kwargs: Any) -> None
Verify permissions and prune entities of certain type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
ResourceType
|
The resource type of the entities to prune. |
required |
prune_method
|
Callable[..., None]
|
The method to prune the entities. |
required |
project_id
|
Optional[UUID]
|
The project ID to prune the entities for. |
None
|
kwargs
|
Any
|
Keyword arguments to pass to the prune method. |
{}
|
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
verify_permissions_and_update_entity(id: UUIDOrStr, update_model: AnyUpdate, get_method: Callable[[UUIDOrStr, bool], AnyResponse], update_method: Callable[[UUIDOrStr, AnyUpdate], AnyResponse], **update_method_kwargs: Any) -> AnyResponse
Verify permissions and update an entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
UUIDOrStr
|
The ID of the entity to update. |
required |
update_model
|
AnyUpdate
|
The entity update model. |
required |
get_method
|
Callable[[UUIDOrStr, bool], AnyResponse]
|
The method to fetch the entity. |
required |
update_method
|
Callable[[UUIDOrStr, AnyUpdate], AnyResponse]
|
The method to update the entity. |
required |
update_method_kwargs
|
Any
|
Keyword arguments to pass to the update method. |
{}
|
Returns:
Type | Description |
---|---|
AnyResponse
|
A model of the updated entity. |
Source code in src/zenml/zen_server/rbac/endpoint_utils.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
models
RBAC model classes.
Action
Resource
Bases: BaseModel
RBAC resource model.
parse(resource: str) -> Resource
classmethod
Parse an RBAC resource string into a Resource object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource
|
str
|
The resource to convert. |
required |
Returns:
Type | Description |
---|---|
Resource
|
The converted resource. |
Source code in src/zenml/zen_server/rbac/models.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
validate_project_id() -> Resource
Validate that project_id is set in combination with project-scoped resource types.
Raises:
Type | Description |
---|---|
ValueError
|
If project_id is not set for a project-scoped resource or set for an unscoped resource. |
Returns:
Type | Description |
---|---|
Resource
|
The validated resource. |
Source code in src/zenml/zen_server/rbac/models.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
ResourceType
Bases: StrEnum
Resource types of the server API.
is_project_scoped() -> bool
Check if a resource type is project scoped.
Returns:
Type | Description |
---|---|
bool
|
Whether the resource type is project scoped. |
Source code in src/zenml/zen_server/rbac/models.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
rbac_interface
RBAC interface definition.
RBACInterface
Bases: ABC
RBAC interface definition.
check_permissions(user: UserResponse, resources: Set[Resource], action: Action) -> Dict[Resource, bool]
abstractmethod
Checks if a user has permissions to perform an action on resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User which wants to access a resource. |
required |
resources
|
Set[Resource]
|
The resources the user wants to access. |
required |
action
|
Action
|
The action that the user wants to perform on the resources. |
required |
Returns:
Source code in src/zenml/zen_server/rbac/rbac_interface.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
delete_resources(resources: List[Resource]) -> None
abstractmethod
Delete resource membership information for a list of resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resources
|
List[Resource]
|
The resources for which to delete the resource membership information. |
required |
Source code in src/zenml/zen_server/rbac/rbac_interface.py
77 78 79 80 81 82 83 84 |
|
list_allowed_resource_ids(user: UserResponse, resource: Resource, action: Action) -> Tuple[bool, List[str]]
abstractmethod
Lists all resource IDs of a resource type that a user can access.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User which wants to access a resource. |
required |
resource
|
Resource
|
The resource the user wants to access. |
required |
action
|
Action
|
The action that the user wants to perform on the resource. |
required |
Returns:
Type | Description |
---|---|
bool
|
A tuple (full_resource_access, resource_ids). |
List[str]
|
|
Tuple[bool, List[str]]
|
given action on any instance of the given resource type, |
Tuple[bool, List[str]]
|
otherwise. If |
Tuple[bool, List[str]]
|
will contain the list of instance IDs that the user can perform |
Tuple[bool, List[str]]
|
the action on. |
Source code in src/zenml/zen_server/rbac/rbac_interface.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
update_resource_membership(user: UserResponse, resource: Resource, actions: List[Action]) -> None
abstractmethod
Update the resource membership of a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User for which the resource membership should be updated. |
required |
resource
|
Resource
|
The resource. |
required |
actions
|
List[Action]
|
The actions that the user should be able to perform on the resource. |
required |
Source code in src/zenml/zen_server/rbac/rbac_interface.py
64 65 66 67 68 69 70 71 72 73 74 75 |
|
rbac_sql_zen_store
RBAC SQL Zen Store implementation.
RBACSqlZenStore(skip_default_registrations: bool = False, **kwargs: Any)
Bases: SqlZenStore
Wrapper around the SQLZenStore that implements RBAC functionality.
Source code in src/zenml/zen_stores/base_zen_store.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
utils
RBAC utility functions.
batch_verify_permissions(resources: Set[Resource], action: Action) -> None
Batch permission verification.
Parameters:
Raises:
Type | Description |
---|---|
IllegalOperationError
|
If the user is not allowed to perform the action. |
RuntimeError
|
If the permission verification failed unexpectedly. |
Source code in src/zenml/zen_server/rbac/utils.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
batch_verify_permissions_for_models(models: Sequence[AnyModel], action: Action) -> None
Batch permission verification for models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models
|
Sequence[AnyModel]
|
The models the user wants to perform the action on. |
required |
action
|
Action
|
The action the user wants to perform. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
dehydrate_page(page: Page[AnyResponse]) -> Page[AnyResponse]
Dehydrate all items of a page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
Page[AnyResponse]
|
The page to dehydrate. |
required |
Returns:
Type | Description |
---|---|
Page[AnyResponse]
|
The page with (potentially) dehydrated items. |
Source code in src/zenml/zen_server/rbac/utils.py
51 52 53 54 55 56 57 58 59 60 61 |
|
dehydrate_response_model(model: AnyModel, permissions: Optional[Dict[Resource, bool]] = None) -> AnyModel
Dehydrate a model if necessary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model to dehydrate. |
required |
permissions
|
Optional[Dict[Resource, bool]]
|
Prefetched permissions that will be used to check whether sub-models will be included in the model or not. If a sub-model refers to a resource which is not included in this dictionary, the permissions will be checked with the RBAC component. |
None
|
Returns:
Type | Description |
---|---|
AnyModel
|
The (potentially) dehydrated model. |
Source code in src/zenml/zen_server/rbac/utils.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
dehydrate_response_model_batch(batch: List[AnyResponse]) -> List[AnyResponse]
Dehydrate all items of a batch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch
|
List[AnyResponse]
|
The batch to dehydrate. |
required |
Returns:
Type | Description |
---|---|
List[AnyResponse]
|
The batch with (potentially) dehydrated items. |
Source code in src/zenml/zen_server/rbac/utils.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
delete_model_resource(model: AnyModel) -> None
Delete resource membership information for a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model for which to delete the resource membership information. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
709 710 711 712 713 714 715 |
|
delete_model_resources(models: List[AnyModel]) -> None
Delete resource membership information for a list of models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models
|
List[AnyModel]
|
The models for which to delete the resource membership information. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
|
delete_resources(resources: List[Resource]) -> None
Delete resource membership information for a list of resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resources
|
List[Resource]
|
The resources for which to delete the resource membership information. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
735 736 737 738 739 740 741 742 743 744 745 |
|
get_allowed_resource_ids(resource_type: str, action: Action = Action.READ, project_id: Optional[UUID] = None) -> Optional[Set[UUID]]
Get all resource IDs of a resource type that a user can access.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
str
|
The resource type. |
required |
action
|
Action
|
The action the user wants to perform on the resource. |
READ
|
project_id
|
Optional[UUID]
|
Optional project ID to filter the resources by. Required for project scoped resources. |
None
|
Returns:
Type | Description |
---|---|
Optional[Set[UUID]]
|
A list of resource IDs or |
Optional[Set[UUID]]
|
all instances of the resource. |
Source code in src/zenml/zen_server/rbac/utils.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
get_permission_denied_model(model: AnyResponse) -> AnyResponse
Get a model to return in case of missing read permissions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyResponse
|
The original model. |
required |
Returns:
Type | Description |
---|---|
AnyResponse
|
The permission denied model. |
Source code in src/zenml/zen_server/rbac/utils.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
get_resource_for_model(model: AnyModel) -> Optional[Resource]
Get the resource associated with a model object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model for which to get the resource. |
required |
Returns:
Source code in src/zenml/zen_server/rbac/utils.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
get_resource_type_for_model(model: AnyModel) -> Optional[ResourceType]
Get the resource type associated with a model object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model for which to get the resource type. |
required |
Returns:
Type | Description |
---|---|
Optional[ResourceType]
|
The resource type associated with the model, or |
Optional[ResourceType]
|
is not associated with any resource type. |
Source code in src/zenml/zen_server/rbac/utils.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
get_schema_for_resource_type(resource_type: ResourceType) -> Type[BaseSchema]
Get the database schema for a resource type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
ResourceType
|
The resource type for which to get the database schema. |
required |
Returns:
Type | Description |
---|---|
Type[BaseSchema]
|
The database schema. |
Source code in src/zenml/zen_server/rbac/utils.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
|
get_subresources_for_model(model: AnyModel) -> Set[Resource]
Get all sub-resources of a model which need permission verification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model for which to get all the resources. |
required |
Returns:
Type | Description |
---|---|
Set[Resource]
|
All resources of a model which need permission verification. |
Source code in src/zenml/zen_server/rbac/utils.py
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
get_surrogate_permission_model_for_model(model: BaseModel, action: str) -> BaseModel
Get a surrogate permission model for a model.
In some cases a different model instead of the original model is used to verify permissions. For example, a parent container model might be used to verify permissions for all its children.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
BaseModel
|
The original model. |
required |
action
|
str
|
The action that the user wants to perform on the model. |
required |
Returns:
Type | Description |
---|---|
BaseModel
|
A surrogate model or the original. |
Source code in src/zenml/zen_server/rbac/utils.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
has_permissions_for_model(model: AnyModel, action: Action) -> bool
If the active user has permissions to perform the action on the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model the user wants to perform the action on. |
required |
action
|
Action
|
The action the user wants to perform. |
required |
Returns:
Type | Description |
---|---|
bool
|
If the active user has permissions to perform the action on the model. |
Source code in src/zenml/zen_server/rbac/utils.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
is_owned_by_authenticated_user(model: AnyModel) -> bool
Returns whether the currently authenticated user owns the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model for which to check the ownership. |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether the currently authenticated user owns the model. |
Source code in src/zenml/zen_server/rbac/utils.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
|
update_resource_membership(user: UserResponse, resource: Resource, actions: List[Action]) -> None
Update the resource membership of a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User for which the resource membership should be updated. |
required |
resource
|
Resource
|
The resource. |
required |
actions
|
List[Action]
|
The actions that the user should be able to perform on the resource. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 |
|
verify_permission(resource_type: str, action: Action, resource_id: Optional[UUID] = None, project_id: Optional[UUID] = None) -> None
Verifies if a user has permission to perform an action on a resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource_type
|
str
|
The type of resource that the user wants to perform the action on. |
required |
action
|
Action
|
The action the user wants to perform. |
required |
resource_id
|
Optional[UUID]
|
ID of the resource the user wants to perform the action on. |
None
|
project_id
|
Optional[UUID]
|
ID of the project the user wants to perform the action on. Only used for project scoped resources. |
None
|
Source code in src/zenml/zen_server/rbac/utils.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
verify_permission_for_model(model: AnyModel, action: Action) -> None
Verifies if a user has permission to perform an action on a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
AnyModel
|
The model the user wants to perform the action on. |
required |
action
|
Action
|
The action the user wants to perform. |
required |
Source code in src/zenml/zen_server/rbac/utils.py
249 250 251 252 253 254 255 256 |
|
zenml_cloud_rbac
Cloud RBAC implementation.
ZenMLCloudRBAC()
Bases: RBACInterface
RBAC implementation that uses the ZenML Pro Management Plane as a backend.
Initialize the object.
Source code in src/zenml/zen_server/rbac/zenml_cloud_rbac.py
35 36 37 |
|
check_permissions(user: UserResponse, resources: Set[Resource], action: Action) -> Dict[Resource, bool]
Checks if a user has permissions to perform an action on resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User which wants to access a resource. |
required |
resources
|
Set[Resource]
|
The resources the user wants to access. |
required |
action
|
Action
|
The action that the user wants to perform on the resources. |
required |
Returns:
Source code in src/zenml/zen_server/rbac/zenml_cloud_rbac.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
delete_resources(resources: List[Resource]) -> None
Delete resource membership information for a list of resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resources
|
List[Resource]
|
The resources for which to delete the resource membership information. |
required |
Source code in src/zenml/zen_server/rbac/zenml_cloud_rbac.py
141 142 143 144 145 146 147 148 149 150 151 |
|
list_allowed_resource_ids(user: UserResponse, resource: Resource, action: Action) -> Tuple[bool, List[str]]
Lists all resource IDs of a resource type that a user can access.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User which wants to access a resource. |
required |
resource
|
Resource
|
The resource the user wants to access. |
required |
action
|
Action
|
The action that the user wants to perform on the resource. |
required |
Returns:
Type | Description |
---|---|
bool
|
A tuple (full_resource_access, resource_ids). |
List[str]
|
|
Tuple[bool, List[str]]
|
given action on any instance of the given resource type, |
Tuple[bool, List[str]]
|
otherwise. If |
Tuple[bool, List[str]]
|
will contain the list of instance IDs that the user can perform |
Tuple[bool, List[str]]
|
the action on. |
Source code in src/zenml/zen_server/rbac/zenml_cloud_rbac.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
update_resource_membership(user: UserResponse, resource: Resource, actions: List[Action]) -> None
Update the resource membership of a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserResponse
|
User for which the resource membership should be updated. |
required |
resource
|
Resource
|
The resource. |
required |
actions
|
List[Action]
|
The actions that the user should be able to perform on the resource. |
required |
Source code in src/zenml/zen_server/rbac/zenml_cloud_rbac.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
routers
Endpoint definitions.
Modules
actions_endpoints
Endpoint definitions for actions.
create_action(action: ActionRequest, _: AuthContext = Security(authorize)) -> ActionResponse
Creates an action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action
|
ActionRequest
|
Action to create. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the action handler for flavor/type is not valid. |
Returns:
Type | Description |
---|---|
ActionResponse
|
The created action. |
Source code in src/zenml/zen_server/routers/actions_endpoints.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
delete_action(action_id: UUID, force: bool = False, _: AuthContext = Security(authorize)) -> None
Delete an action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_id
|
UUID
|
ID of the action. |
required |
force
|
bool
|
Flag deciding whether to force delete the action. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the action handler for flavor/type is not valid. |
Source code in src/zenml/zen_server/routers/actions_endpoints.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
get_action(action_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ActionResponse
Returns the requested action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_id
|
UUID
|
ID of the action. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Raises:
Type | Description |
---|---|
ValueError
|
If the action handler for flavor/type is not valid. |
Returns:
Type | Description |
---|---|
ActionResponse
|
The requested action. |
Source code in src/zenml/zen_server/routers/actions_endpoints.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
list_actions(action_filter_model: ActionFilter = Depends(make_dependable(ActionFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ActionResponse]
List actions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_filter_model
|
ActionFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ActionFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ActionResponse]
|
Page of actions. |
Source code in src/zenml/zen_server/routers/actions_endpoints.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
update_action(action_id: UUID, action_update: ActionUpdate, _: AuthContext = Security(authorize)) -> ActionResponse
Update an action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_id
|
UUID
|
ID of the action to update. |
required |
action_update
|
ActionUpdate
|
The action update. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the action handler for flavor/type is not valid. |
Returns:
Type | Description |
---|---|
ActionResponse
|
The updated action. |
Source code in src/zenml/zen_server/routers/actions_endpoints.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
artifact_endpoint
Endpoint definitions for artifacts.
create_artifact(artifact: ArtifactRequest, _: AuthContext = Security(authorize)) -> ArtifactResponse
Create a new artifact.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact
|
ArtifactRequest
|
The artifact to create. |
required |
Returns:
Type | Description |
---|---|
ArtifactResponse
|
The created artifact. |
Source code in src/zenml/zen_server/routers/artifact_endpoint.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
delete_artifact(artifact_id: UUID, _: AuthContext = Security(authorize)) -> None
Delete an artifact by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_id
|
UUID
|
The ID of the artifact to delete. |
required |
Source code in src/zenml/zen_server/routers/artifact_endpoint.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
get_artifact(artifact_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ArtifactResponse
Get an artifact by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_id
|
UUID
|
The ID of the artifact to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ArtifactResponse
|
The artifact with the given ID. |
Source code in src/zenml/zen_server/routers/artifact_endpoint.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
list_artifacts(artifact_filter_model: ArtifactFilter = Depends(make_dependable(ArtifactFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ArtifactResponse]
Get artifacts according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_filter_model
|
ArtifactFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ArtifactFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ArtifactResponse]
|
The artifacts according to query filters. |
Source code in src/zenml/zen_server/routers/artifact_endpoint.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
update_artifact(artifact_id: UUID, artifact_update: ArtifactUpdate, _: AuthContext = Security(authorize)) -> ArtifactResponse
Update an artifact by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_id
|
UUID
|
The ID of the artifact to update. |
required |
artifact_update
|
ArtifactUpdate
|
The update to apply to the artifact. |
required |
Returns:
Type | Description |
---|---|
ArtifactResponse
|
The updated artifact. |
Source code in src/zenml/zen_server/routers/artifact_endpoint.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
artifact_version_endpoints
Endpoint definitions for artifact versions.
batch_create_artifact_version(artifact_versions: List[ArtifactVersionRequest], _: AuthContext = Security(authorize)) -> List[ArtifactVersionResponse]
Create a batch of artifact versions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_versions
|
List[ArtifactVersionRequest]
|
The artifact versions to create. |
required |
Returns:
Type | Description |
---|---|
List[ArtifactVersionResponse]
|
The created artifact versions. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
create_artifact_version(artifact_version: ArtifactVersionRequest, _: AuthContext = Security(authorize)) -> ArtifactVersionResponse
Create a new artifact version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version
|
ArtifactVersionRequest
|
The artifact version to create. |
required |
Returns:
Type | Description |
---|---|
ArtifactVersionResponse
|
The created artifact version. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
delete_artifact_version(artifact_version_id: UUID, _: AuthContext = Security(authorize)) -> None
Delete an artifact version by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version_id
|
UUID
|
The ID of the artifact version to delete. |
required |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
get_artifact_version(artifact_version_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ArtifactVersionResponse
Get an artifact version by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version_id
|
UUID
|
The ID of the artifact version to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ArtifactVersionResponse
|
The artifact version with the given ID. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
get_artifact_visualization(artifact_version_id: UUID, index: int = 0, _: AuthContext = Security(authorize)) -> LoadedVisualization
Get the visualization of an artifact.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version_id
|
UUID
|
ID of the artifact version for which to get the visualization. |
required |
index
|
int
|
Index of the visualization to get (if there are multiple). |
0
|
Returns:
Type | Description |
---|---|
LoadedVisualization
|
The visualization of the artifact version. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
list_artifact_versions(artifact_version_filter_model: ArtifactVersionFilter = Depends(make_dependable(ArtifactVersionFilter)), hydrate: bool = False, auth_context: AuthContext = Security(authorize)) -> Page[ArtifactVersionResponse]
Get artifact versions according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version_filter_model
|
ArtifactVersionFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ArtifactVersionFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
Page[ArtifactVersionResponse]
|
The artifact versions according to query filters. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
prune_artifact_versions(project_name_or_id: Union[str, UUID], only_versions: bool = True, _: AuthContext = Security(authorize)) -> None
Prunes unused artifact versions and their artifacts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
Union[str, UUID]
|
The project name or ID to prune artifact versions for. |
required |
only_versions
|
bool
|
Only delete artifact versions, keeping artifacts |
True
|
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
update_artifact_version(artifact_version_id: UUID, artifact_version_update: ArtifactVersionUpdate, _: AuthContext = Security(authorize)) -> ArtifactVersionResponse
Update an artifact by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact_version_id
|
UUID
|
The ID of the artifact version to update. |
required |
artifact_version_update
|
ArtifactVersionUpdate
|
The update to apply to the artifact version. |
required |
Returns:
Type | Description |
---|---|
ArtifactVersionResponse
|
The updated artifact. |
Source code in src/zenml/zen_server/routers/artifact_version_endpoints.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
auth_endpoints
Endpoint definitions for authentication (login).
OAuthLoginRequestForm(grant_type: Optional[str] = Form(None), username: Optional[str] = Form(None), password: Optional[str] = Form(None), client_id: Optional[str] = Form(None), device_code: Optional[str] = Form(None))
OAuth2 grant type request form.
This form allows multiple grant types to be used with the same endpoint: * standard OAuth2 password grant type * standard OAuth2 device authorization grant type * ZenML service account + API key grant type (proprietary) * ZenML External Authenticator grant type (proprietary)
Initializes the form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grant_type
|
Optional[str]
|
The grant type. |
Form(None)
|
username
|
Optional[str]
|
The username. Only used for the password grant type. |
Form(None)
|
password
|
Optional[str]
|
The password. Only used for the password grant type. |
Form(None)
|
client_id
|
Optional[str]
|
The client ID. |
Form(None)
|
device_code
|
Optional[str]
|
The device code. Only used for the device authorization grant type. |
Form(None)
|
Raises:
Type | Description |
---|---|
HTTPException
|
If the request is invalid. |
Source code in src/zenml/zen_server/routers/auth_endpoints.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
api_token(token_type: APITokenType = APITokenType.GENERIC, expires_in: Optional[int] = None, schedule_id: Optional[UUID] = None, pipeline_run_id: Optional[UUID] = None, step_run_id: Optional[UUID] = None, auth_context: AuthContext = Security(authorize)) -> str
Generate an API token for the current user.
Use this endpoint to generate an API token for the current user. Two types of API tokens are supported:
- Generic API token: This token is short-lived and can be used for generic automation tasks. The expiration can be set by the user, but the server will impose a maximum expiration time.
- Workload API token: This token is scoped to a specific pipeline run, step run or schedule and is used by pipeline workloads to authenticate with the server. A pipeline run ID, step run ID or schedule ID must be provided and the generated token will only be valid for the indicated pipeline run, step run or schedule. No time limit is imposed on the validity of the token. A workload API token can be used to authenticate and generate another workload API token, but only for the same schedule, pipeline run ID or step run ID, in that order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token_type
|
APITokenType
|
The type of API token to generate. |
GENERIC
|
expires_in
|
Optional[int]
|
The expiration time of the generic API token in seconds. If not set, the server will use the default expiration time for generic API tokens. The server also imposes a maximum expiration time. |
None
|
schedule_id
|
Optional[UUID]
|
The ID of the schedule to scope the workload API token to. |
None
|
pipeline_run_id
|
Optional[UUID]
|
The ID of the pipeline run to scope the workload API token to. |
None
|
step_run_id
|
Optional[UUID]
|
The ID of the step run to scope the workload API token to. |
None
|
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
str
|
The API token. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
If not authorized to generate the API token. |
ValueError
|
If the request is invalid. |
Source code in src/zenml/zen_server/routers/auth_endpoints.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
|
device_authorization(request: Request, client_id: UUID = Form(...)) -> OAuthDeviceAuthorizationResponse
OAuth2 device authorization endpoint.
This endpoint implements the OAuth2 device authorization grant flow as defined in https://tools.ietf.org/html/rfc8628. It is called to initiate the device authorization flow by requesting a device and user code for a given client ID.
For a new client ID, a new OAuth device is created, stored in the DB and returned to the client along with a pair of newly generated device and user codes. If a device for the given client ID already exists, the existing DB entry is reused and new device and user codes are generated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The request object. |
required |
client_id
|
UUID
|
The client ID. |
Form(...)
|
Returns:
Type | Description |
---|---|
OAuthDeviceAuthorizationResponse
|
The device authorization response. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the device authorization is not supported. |
Source code in src/zenml/zen_server/routers/auth_endpoints.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
|
logout(response: Response) -> None
Logs out the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
Response
|
The response object. |
required |
Source code in src/zenml/zen_server/routers/auth_endpoints.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
|
token(request: Request, response: Response, auth_form_data: OAuthLoginRequestForm = Depends()) -> Union[OAuthTokenResponse, OAuthRedirectResponse]
OAuth2 token endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The request object. |
required |
response
|
Response
|
The response object. |
required |
auth_form_data
|
OAuthLoginRequestForm
|
The OAuth 2.0 authentication form data. |
Depends()
|
Returns:
Type | Description |
---|---|
Union[OAuthTokenResponse, OAuthRedirectResponse]
|
An access token or a redirect response. |
Raises:
Type | Description |
---|---|
ValueError
|
If the grant type is invalid. |
Source code in src/zenml/zen_server/routers/auth_endpoints.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
code_repositories_endpoints
Endpoint definitions for code repositories.
create_code_repository(code_repository: CodeRepositoryRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> CodeRepositoryResponse
Creates a code repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_repository
|
CodeRepositoryRequest
|
Code repository to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
CodeRepositoryResponse
|
The created code repository. |
Source code in src/zenml/zen_server/routers/code_repositories_endpoints.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
delete_code_repository(code_repository_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific code repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_repository_id
|
UUID
|
The ID of the code repository to delete. |
required |
Source code in src/zenml/zen_server/routers/code_repositories_endpoints.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
get_code_repository(code_repository_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> CodeRepositoryResponse
Gets a specific code repository using its unique ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_repository_id
|
UUID
|
The ID of the code repository to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
CodeRepositoryResponse
|
A specific code repository object. |
Source code in src/zenml/zen_server/routers/code_repositories_endpoints.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
list_code_repositories(filter_model: CodeRepositoryFilter = Depends(make_dependable(CodeRepositoryFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[CodeRepositoryResponse]
Gets a page of code repositories.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
CodeRepositoryFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(CodeRepositoryFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[CodeRepositoryResponse]
|
Page of code repository objects. |
Source code in src/zenml/zen_server/routers/code_repositories_endpoints.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
update_code_repository(code_repository_id: UUID, update: CodeRepositoryUpdate, _: AuthContext = Security(authorize)) -> CodeRepositoryResponse
Updates a code repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_repository_id
|
UUID
|
The ID of the code repository to update. |
required |
update
|
CodeRepositoryUpdate
|
The model containing the attributes to update. |
required |
Returns:
Type | Description |
---|---|
CodeRepositoryResponse
|
The updated code repository object. |
Source code in src/zenml/zen_server/routers/code_repositories_endpoints.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
devices_endpoints
Endpoint definitions for code repositories.
delete_authorized_device(device_id: UUID, auth_context: AuthContext = Security(authorize)) -> None
Deletes a specific OAuth2 authorized device using its unique ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
UUID
|
The ID of the OAuth2 authorized device to delete. |
required |
auth_context
|
AuthContext
|
The current auth context. |
Security(authorize)
|
Raises:
Type | Description |
---|---|
KeyError
|
If the device with the given ID does not exist or does not belong to the current user. |
Source code in src/zenml/zen_server/routers/devices_endpoints.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|
get_authorization_device(device_id: UUID, user_code: Optional[str] = None, hydrate: bool = True, auth_context: AuthContext = Security(authorize)) -> OAuthDeviceResponse
Gets a specific OAuth2 authorized device using its unique ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
UUID
|
The ID of the OAuth2 authorized device to get. |
required |
user_code
|
Optional[str]
|
The user code of the OAuth2 authorized device to get. Needs to be specified with devices that have not been verified yet. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
auth_context
|
AuthContext
|
The current auth context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
OAuthDeviceResponse
|
A specific OAuth2 authorized device object. |
Raises:
Type | Description |
---|---|
KeyError
|
If the device with the given ID does not exist, does not belong to the current user or could not be verified using the given user code. |
Source code in src/zenml/zen_server/routers/devices_endpoints.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
list_authorized_devices(filter_model: OAuthDeviceFilter = Depends(make_dependable(OAuthDeviceFilter)), hydrate: bool = False, auth_context: AuthContext = Security(authorize)) -> Page[OAuthDeviceResponse]
Gets a page of OAuth2 authorized devices belonging to the current user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
OAuthDeviceFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(OAuthDeviceFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
auth_context
|
AuthContext
|
The current auth context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
Page[OAuthDeviceResponse]
|
Page of OAuth2 authorized device objects. |
Source code in src/zenml/zen_server/routers/devices_endpoints.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
update_authorized_device(device_id: UUID, update: OAuthDeviceUpdate, auth_context: AuthContext = Security(authorize)) -> OAuthDeviceResponse
Updates a specific OAuth2 authorized device using its unique ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
UUID
|
The ID of the OAuth2 authorized device to update. |
required |
update
|
OAuthDeviceUpdate
|
The model containing the attributes to update. |
required |
auth_context
|
AuthContext
|
The current auth context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
OAuthDeviceResponse
|
The updated OAuth2 authorized device object. |
Raises:
Type | Description |
---|---|
KeyError
|
If the device with the given ID does not exist or does not belong to the current user. |
Source code in src/zenml/zen_server/routers/devices_endpoints.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
verify_authorized_device(device_id: UUID, request: OAuthDeviceVerificationRequest, auth_context: AuthContext = Security(authorize)) -> OAuthDeviceResponse
Verifies a specific OAuth2 authorized device using its unique ID.
This endpoint implements the OAuth2 device authorization grant flow as defined in https://tools.ietf.org/html/rfc8628. It is called to verify the user code for a given device ID.
If the user code is valid, the device is marked as verified and associated with the user that authorized the device. This association is required to be able to issue access tokens or revoke the device later on.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_id
|
UUID
|
The ID of the OAuth2 authorized device to update. |
required |
request
|
OAuthDeviceVerificationRequest
|
The model containing the verification request. |
required |
auth_context
|
AuthContext
|
The current auth context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
OAuthDeviceResponse
|
The updated OAuth2 authorized device object. |
Raises:
Type | Description |
---|---|
ValueError
|
If the device verification request fails. |
Source code in src/zenml/zen_server/routers/devices_endpoints.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
event_source_endpoints
Endpoint definitions for event sources.
create_event_source(event_source: EventSourceRequest, _: AuthContext = Security(authorize)) -> EventSourceResponse
Creates an event source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source
|
EventSourceRequest
|
EventSource to register. |
required |
Returns:
Type | Description |
---|---|
EventSourceResponse
|
The created event source. |
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin for an event source is not a valid event source plugin. |
Source code in src/zenml/zen_server/routers/event_source_endpoints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
delete_event_source(event_source_id: UUID, force: bool = False, _: AuthContext = Security(authorize)) -> None
Deletes a event_source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source_id
|
UUID
|
Name of the event_source. |
required |
force
|
bool
|
Flag deciding whether to force delete the event source. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin for an event source is not a valid event source plugin. |
Source code in src/zenml/zen_server/routers/event_source_endpoints.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
get_event_source(event_source_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> EventSourceResponse
Returns the requested event_source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source_id
|
UUID
|
ID of the event_source. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
EventSourceResponse
|
The requested event_source. |
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin for an event source is not a valid event source plugin. |
Source code in src/zenml/zen_server/routers/event_source_endpoints.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
list_event_sources(event_source_filter_model: EventSourceFilter = Depends(make_dependable(EventSourceFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[EventSourceResponse]
Returns all event_sources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source_filter_model
|
EventSourceFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(EventSourceFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[EventSourceResponse]
|
All event_sources. |
Source code in src/zenml/zen_server/routers/event_source_endpoints.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
update_event_source(event_source_id: UUID, event_source_update: EventSourceUpdate, _: AuthContext = Security(authorize)) -> EventSourceResponse
Updates an event_source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source_id
|
UUID
|
Name of the event_source. |
required |
event_source_update
|
EventSourceUpdate
|
EventSource to use for the update. |
required |
Returns:
Type | Description |
---|---|
EventSourceResponse
|
The updated event_source. |
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin for an event source is not a valid event source plugin. |
Source code in src/zenml/zen_server/routers/event_source_endpoints.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
flavors_endpoints
Endpoint definitions for flavors.
create_flavor(flavor: FlavorRequest, _: AuthContext = Security(authorize)) -> FlavorResponse
Creates a stack component flavor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor
|
FlavorRequest
|
Stack component flavor to register. |
required |
Returns:
Type | Description |
---|---|
FlavorResponse
|
The created stack component flavor. |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
delete_flavor(flavor_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a flavor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_id
|
UUID
|
ID of the flavor. |
required |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
get_flavor(flavor_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> FlavorResponse
Returns the requested flavor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_id
|
UUID
|
ID of the flavor. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
FlavorResponse
|
The requested stack. |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
list_flavors(flavor_filter_model: FlavorFilter = Depends(make_dependable(FlavorFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[FlavorResponse]
Returns all flavors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_filter_model
|
FlavorFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(FlavorFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[FlavorResponse]
|
All flavors. |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
sync_flavors(_: AuthContext = Security(authorize)) -> None
Purge all in-built and integration flavors from the DB and sync.
Returns:
Type | Description |
---|---|
None
|
None if successful. Raises an exception otherwise. |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
update_flavor(flavor_id: UUID, flavor_update: FlavorUpdate, _: AuthContext = Security(authorize)) -> FlavorResponse
Updates a flavor.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_id
|
UUID
|
ID of the flavor to update. |
required |
flavor_update
|
FlavorUpdate
|
Flavor update. |
required |
Returns:
Type | Description |
---|---|
FlavorResponse
|
The updated flavor. |
Source code in src/zenml/zen_server/routers/flavors_endpoints.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
logs_endpoints
Endpoint definitions for logs.
get_logs(logs_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> LogsResponse
Returns the requested logs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logs_id
|
UUID
|
ID of the logs. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
LogsResponse
|
The requested logs. |
Source code in src/zenml/zen_server/routers/logs_endpoints.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
model_versions_endpoints
Endpoint definitions for models.
create_model_version(model_version: ModelVersionRequest, model_id: Optional[UUID] = None, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> ModelVersionResponse
Creates a model version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version
|
ModelVersionRequest
|
Model version to create. |
required |
model_id
|
Optional[UUID]
|
Optional ID of the model. |
None
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
ModelVersionResponse
|
The created model version. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
create_model_version_artifact_link(model_version_artifact_link: ModelVersionArtifactRequest, _: AuthContext = Security(authorize)) -> ModelVersionArtifactResponse
Create a new model version to artifact link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_artifact_link
|
ModelVersionArtifactRequest
|
The model version to artifact link to create. |
required |
Returns:
Type | Description |
---|---|
ModelVersionArtifactResponse
|
The created model version to artifact link. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
|
create_model_version_pipeline_run_link(model_version_pipeline_run_link: ModelVersionPipelineRunRequest, _: AuthContext = Security(authorize)) -> ModelVersionPipelineRunResponse
Create a new model version to pipeline run link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_pipeline_run_link
|
ModelVersionPipelineRunRequest
|
The model version to pipeline run link to create. |
required |
Returns:
Type | Description |
---|---|
ModelVersionPipelineRunResponse
|
|
ModelVersionPipelineRunResponse
|
|
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
delete_all_model_version_artifact_links(model_version_id: UUID, only_links: bool = True, _: AuthContext = Security(authorize)) -> None
Deletes all model version to artifact links.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
ID of the model version containing links. |
required |
only_links
|
bool
|
Whether to only delete the link to the artifact. |
True
|
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
delete_model_version(model_version_id: UUID, _: AuthContext = Security(authorize)) -> None
Delete a model by name or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
The name or ID of the model version to delete. |
required |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
delete_model_version_artifact_link(model_version_id: UUID, model_version_artifact_link_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Deletes a model version to artifact link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
ID of the model version containing the link. |
required |
model_version_artifact_link_name_or_id
|
Union[str, UUID]
|
name or ID of the model version to artifact link to be deleted. |
required |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
|
delete_model_version_pipeline_run_link(model_version_id: UUID, model_version_pipeline_run_link_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Deletes a model version link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
name or ID of the model version containing the link. |
required |
model_version_pipeline_run_link_name_or_id
|
Union[str, UUID]
|
name or ID of the model version link to be deleted. |
required |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
|
get_model_version(model_version_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ModelVersionResponse
Get a model version by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
id of the model version to be retrieved. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ModelVersionResponse
|
The model version with the given name or ID. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
list_model_version_artifact_links(model_version_artifact_link_filter_model: ModelVersionArtifactFilter = Depends(make_dependable(ModelVersionArtifactFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ModelVersionArtifactResponse]
Get model version to artifact links according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_artifact_link_filter_model
|
ModelVersionArtifactFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ModelVersionArtifactFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ModelVersionArtifactResponse]
|
The model version to artifact links according to query filters. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
list_model_version_pipeline_run_links(model_version_pipeline_run_link_filter_model: ModelVersionPipelineRunFilter = Depends(make_dependable(ModelVersionPipelineRunFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ModelVersionPipelineRunResponse]
Get model version to pipeline run links according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_pipeline_run_link_filter_model
|
ModelVersionPipelineRunFilter
|
Filter model used for pagination, sorting, and filtering. |
Depends(make_dependable(ModelVersionPipelineRunFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ModelVersionPipelineRunResponse]
|
The model version to pipeline run links according to query filters. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
|
list_model_versions(model_version_filter_model: ModelVersionFilter = Depends(make_dependable(ModelVersionFilter)), model_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, auth_context: AuthContext = Security(authorize)) -> Page[ModelVersionResponse]
Get model versions according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_filter_model
|
ModelVersionFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ModelVersionFilter))
|
model_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the model. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
Page[ModelVersionResponse]
|
The model versions according to query filters. |
Raises:
Type | Description |
---|---|
ValueError
|
If the model is missing from the filter. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
update_model_version(model_version_id: UUID, model_version_update_model: ModelVersionUpdate, _: AuthContext = Security(authorize)) -> ModelVersionResponse
Get all model versions by filter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_version_id
|
UUID
|
The ID of model version to be updated. |
required |
model_version_update_model
|
ModelVersionUpdate
|
The model version to be updated. |
required |
Returns:
Type | Description |
---|---|
ModelVersionResponse
|
An updated model version. |
Source code in src/zenml/zen_server/routers/model_versions_endpoints.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
models_endpoints
Endpoint definitions for models.
create_model(model: ModelRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> ModelResponse
Creates a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
ModelRequest
|
Model to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
ModelResponse
|
The created model. |
Source code in src/zenml/zen_server/routers/models_endpoints.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
delete_model(model_id: UUID, _: AuthContext = Security(authorize)) -> None
Delete a model by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
UUID
|
The ID of the model to delete. |
required |
Source code in src/zenml/zen_server/routers/models_endpoints.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
get_model(model_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ModelResponse
Get a model by name or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
UUID
|
The ID of the model to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ModelResponse
|
The model with the given name or ID. |
Source code in src/zenml/zen_server/routers/models_endpoints.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
list_models(model_filter_model: ModelFilter = Depends(make_dependable(ModelFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ModelResponse]
Get models according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_filter_model
|
ModelFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ModelFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ModelResponse]
|
The models according to query filters. |
Source code in src/zenml/zen_server/routers/models_endpoints.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
update_model(model_id: UUID, model_update: ModelUpdate, _: AuthContext = Security(authorize)) -> ModelResponse
Updates a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
UUID
|
Name of the stack. |
required |
model_update
|
ModelUpdate
|
Stack to use for the update. |
required |
Returns:
Type | Description |
---|---|
ModelResponse
|
The updated model. |
Source code in src/zenml/zen_server/routers/models_endpoints.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
pipeline_builds_endpoints
Endpoint definitions for builds.
create_build(build: PipelineBuildRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> PipelineBuildResponse
Creates a build, optionally in a specific project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
build
|
PipelineBuildRequest
|
Build to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
PipelineBuildResponse
|
The created build. |
Source code in src/zenml/zen_server/routers/pipeline_builds_endpoints.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
delete_build(build_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific build.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
build_id
|
UUID
|
ID of the build to delete. |
required |
Source code in src/zenml/zen_server/routers/pipeline_builds_endpoints.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
get_build(build_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> PipelineBuildResponse
Gets a specific build using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
build_id
|
UUID
|
ID of the build to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
PipelineBuildResponse
|
A specific build object. |
Source code in src/zenml/zen_server/routers/pipeline_builds_endpoints.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
list_builds(build_filter_model: PipelineBuildFilter = Depends(make_dependable(PipelineBuildFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[PipelineBuildResponse]
Gets a list of builds.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
build_filter_model
|
PipelineBuildFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(PipelineBuildFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[PipelineBuildResponse]
|
List of build objects matching the filter criteria. |
Source code in src/zenml/zen_server/routers/pipeline_builds_endpoints.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
pipeline_deployments_endpoints
Endpoint definitions for deployments.
create_deployment(deployment: PipelineDeploymentRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> PipelineDeploymentResponse
Creates a deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentRequest
|
Deployment to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
PipelineDeploymentResponse
|
The created deployment. |
Source code in src/zenml/zen_server/routers/pipeline_deployments_endpoints.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
delete_deployment(deployment_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment_id
|
UUID
|
ID of the deployment to delete. |
required |
Source code in src/zenml/zen_server/routers/pipeline_deployments_endpoints.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
deployment_logs(deployment_id: UUID, _: AuthContext = Security(authorize)) -> str
Get deployment logs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment_id
|
UUID
|
ID of the deployment. |
required |
Returns:
Type | Description |
---|---|
str
|
The deployment logs. |
Source code in src/zenml/zen_server/routers/pipeline_deployments_endpoints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
get_deployment(deployment_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> PipelineDeploymentResponse
Gets a specific deployment using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment_id
|
UUID
|
ID of the deployment to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
PipelineDeploymentResponse
|
A specific deployment object. |
Source code in src/zenml/zen_server/routers/pipeline_deployments_endpoints.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
list_deployments(deployment_filter_model: PipelineDeploymentFilter = Depends(make_dependable(PipelineDeploymentFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[PipelineDeploymentResponse]
Gets a list of deployments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment_filter_model
|
PipelineDeploymentFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(PipelineDeploymentFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[PipelineDeploymentResponse]
|
List of deployment objects matching the filter criteria. |
Source code in src/zenml/zen_server/routers/pipeline_deployments_endpoints.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
pipelines_endpoints
Endpoint definitions for pipelines.
create_pipeline(pipeline: PipelineRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> PipelineResponse
Creates a pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline
|
PipelineRequest
|
Pipeline to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
PipelineResponse
|
The created pipeline. |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
delete_pipeline(pipeline_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_id
|
UUID
|
ID of the pipeline to delete. |
required |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
get_pipeline(pipeline_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> PipelineResponse
Gets a specific pipeline using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_id
|
UUID
|
ID of the pipeline to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
PipelineResponse
|
A specific pipeline object. |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
list_pipeline_runs(pipeline_run_filter_model: PipelineRunFilter = Depends(make_dependable(PipelineRunFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[PipelineRunResponse]
Get pipeline runs according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_run_filter_model
|
PipelineRunFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(PipelineRunFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[PipelineRunResponse]
|
The pipeline runs according to query filters. |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
list_pipelines(pipeline_filter_model: PipelineFilter = Depends(make_dependable(PipelineFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[PipelineResponse]
Gets a list of pipelines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_filter_model
|
PipelineFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(PipelineFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[PipelineResponse]
|
List of pipeline objects matching the filter criteria. |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
update_pipeline(pipeline_id: UUID, pipeline_update: PipelineUpdate, _: AuthContext = Security(authorize)) -> PipelineResponse
Updates the attribute on a specific pipeline using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_id
|
UUID
|
ID of the pipeline to get. |
required |
pipeline_update
|
PipelineUpdate
|
the model containing the attributes to update. |
required |
Returns:
Type | Description |
---|---|
PipelineResponse
|
The updated pipeline object. |
Source code in src/zenml/zen_server/routers/pipelines_endpoints.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
plugin_endpoints
Endpoint definitions for plugin flavors.
get_flavor(name: str, type: PluginType = Query(..., alias='type'), subtype: PluginSubType = Query(..., alias='subtype'), _: AuthContext = Security(authorize)) -> BasePluginFlavorResponse
Returns the requested flavor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the flavor. |
required |
type
|
PluginType
|
Type of Plugin |
Query(..., alias='type')
|
subtype
|
PluginSubType
|
Subtype of Plugin |
Query(..., alias='subtype')
|
Returns:
Type | Description |
---|---|
BasePluginFlavorResponse
|
The requested flavor response. |
Source code in src/zenml/zen_server/routers/plugin_endpoints.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
list_flavors(type: PluginType, subtype: PluginSubType, page: int = PAGINATION_STARTING_PAGE, size: int = PAGE_SIZE_DEFAULT, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[BasePluginFlavorResponse]
Returns all event flavors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
PluginType
|
The type of Plugin |
required |
subtype
|
PluginSubType
|
The subtype of the plugin |
required |
page
|
int
|
Page for pagination (offset +1) |
PAGINATION_STARTING_PAGE
|
size
|
int
|
Page size for pagination |
PAGE_SIZE_DEFAULT
|
hydrate
|
bool
|
Whether to hydrate the response bodies |
False
|
Returns:
Type | Description |
---|---|
Page[BasePluginFlavorResponse]
|
A page of flavors. |
Source code in src/zenml/zen_server/routers/plugin_endpoints.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
projects_endpoints
Endpoint definitions for projects.
create_project(project_request: ProjectRequest, _: AuthContext = Security(authorize)) -> ProjectResponse
Creates a project based on the requestBody.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_request
|
ProjectRequest
|
Project to create. |
required |
Returns:
Type | Description |
---|---|
ProjectResponse
|
The created project. |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
delete_project(project_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Deletes a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
Union[str, UUID]
|
Name or ID of the project. |
required |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
get_project(project_name_or_id: Union[str, UUID], hydrate: bool = True, _: AuthContext = Security(authorize)) -> ProjectResponse
Get a project for given name.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
Union[str, UUID]
|
Name or ID of the project. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ProjectResponse
|
The requested project. |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
get_project_statistics(project_name_or_id: Union[str, UUID], auth_context: AuthContext = Security(authorize)) -> ProjectStatistics
Gets statistics of a project.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
Union[str, UUID]
|
Name or ID of the project to get statistics for. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
ProjectStatistics
|
Project statistics. |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
list_projects(project_filter_model: ProjectFilter = Depends(make_dependable(ProjectFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ProjectResponse]
Lists all projects in the organization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_filter_model
|
ProjectFilter
|
Filter model used for pagination, sorting, filtering, |
Depends(make_dependable(ProjectFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ProjectResponse]
|
A list of projects. |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
update_project(project_name_or_id: UUID, project_update: ProjectUpdate, _: AuthContext = Security(authorize)) -> ProjectResponse
Get a project for given name.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
UUID
|
Name or ID of the project to update. |
required |
project_update
|
ProjectUpdate
|
the project to use to update |
required |
Returns:
Type | Description |
---|---|
ProjectResponse
|
The updated project. |
Source code in src/zenml/zen_server/routers/projects_endpoints.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
run_metadata_endpoints
Endpoint definitions for run metadata.
create_run_metadata(run_metadata: RunMetadataRequest, project_name_or_id: Optional[Union[str, UUID]] = None, auth_context: AuthContext = Security(authorize)) -> None
Creates run metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_metadata
|
RunMetadataRequest
|
The run metadata to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If the resource type is not supported. |
Source code in src/zenml/zen_server/routers/run_metadata_endpoints.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
run_templates_endpoints
Endpoint definitions for run templates.
create_run_template(run_template: RunTemplateRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> RunTemplateResponse
Create a run template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_template
|
RunTemplateRequest
|
Run template to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
RunTemplateResponse
|
The created run template. |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
create_template_run(template_id: UUID, background_tasks: BackgroundTasks, config: Optional[PipelineRunConfiguration] = None, auth_context: AuthContext = Security(authorize)) -> PipelineRunResponse
Run a pipeline from a template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_id
|
UUID
|
The ID of the template. |
required |
background_tasks
|
BackgroundTasks
|
Background tasks. |
required |
config
|
Optional[PipelineRunConfiguration]
|
Configuration for the pipeline run. |
None
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
PipelineRunResponse
|
The created pipeline run. |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
delete_run_template(template_id: UUID, _: AuthContext = Security(authorize)) -> None
Delete a run template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_id
|
UUID
|
ID of the run template to delete. |
required |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
get_run_template(template_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> RunTemplateResponse
Get a run template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_id
|
UUID
|
ID of the run template to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
RunTemplateResponse
|
The run template. |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
list_run_templates(filter_model: RunTemplateFilter = Depends(make_dependable(RunTemplateFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[RunTemplateResponse]
Get a page of run templates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
RunTemplateFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(RunTemplateFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[RunTemplateResponse]
|
Page of run templates. |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
update_run_template(template_id: UUID, update: RunTemplateUpdate, _: AuthContext = Security(authorize)) -> RunTemplateResponse
Update a run template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_id
|
UUID
|
ID of the run template to get. |
required |
update
|
RunTemplateUpdate
|
The updates to apply. |
required |
Returns:
Type | Description |
---|---|
RunTemplateResponse
|
The updated run template. |
Source code in src/zenml/zen_server/routers/run_templates_endpoints.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
runs_endpoints
Endpoint definitions for pipeline runs.
delete_run(run_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the run. |
required |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
|
get_or_create_pipeline_run(pipeline_run: PipelineRunRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> Tuple[PipelineRunResponse, bool]
Get or create a pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_run
|
PipelineRunRequest
|
Pipeline run to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
PipelineRunResponse
|
The pipeline run and a boolean indicating whether the run was created |
bool
|
or not. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
get_pipeline_configuration(run_id: UUID, _: AuthContext = Security(authorize)) -> Dict[str, Any]
Get the pipeline configuration of a specific pipeline run using its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the pipeline run to get. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The pipeline configuration of the pipeline run. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
get_run(run_id: UUID, hydrate: bool = True, refresh_status: bool = False, _: AuthContext = Security(authorize)) -> PipelineRunResponse
Get a specific pipeline run using its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the pipeline run to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
refresh_status
|
bool
|
Flag deciding whether we should try to refresh the status of the pipeline run using its orchestrator. |
False
|
Returns:
Type | Description |
---|---|
PipelineRunResponse
|
The pipeline run. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the stack or the orchestrator of the run is deleted. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
get_run_status(run_id: UUID, _: AuthContext = Security(authorize)) -> ExecutionStatus
Get the status of a specific pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the pipeline run for which to get the status. |
required |
Returns:
Type | Description |
---|---|
ExecutionStatus
|
The status of the pipeline run. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
|
get_run_steps(run_id: UUID, step_run_filter_model: StepRunFilter = Depends(make_dependable(StepRunFilter)), _: AuthContext = Security(authorize)) -> Page[StepRunResponse]
Get all steps for a given pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the pipeline run. |
required |
step_run_filter_model
|
StepRunFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(StepRunFilter))
|
Returns:
Type | Description |
---|---|
Page[StepRunResponse]
|
The steps for a given pipeline run. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
list_runs(runs_filter_model: PipelineRunFilter = Depends(make_dependable(PipelineRunFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[PipelineRunResponse]
Get pipeline runs according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
runs_filter_model
|
PipelineRunFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(PipelineRunFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[PipelineRunResponse]
|
The pipeline runs according to query filters. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
refresh_run_status(run_id: UUID, _: AuthContext = Security(authorize)) -> None
Refreshes the status of a specific pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the pipeline run to refresh. |
required |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the stack or the orchestrator of the run is deleted. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
update_run(run_id: UUID, run_model: PipelineRunUpdate, _: AuthContext = Security(authorize)) -> PipelineRunResponse
Updates a run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id
|
UUID
|
ID of the run. |
required |
run_model
|
PipelineRunUpdate
|
Run model to use for the update. |
required |
Returns:
Type | Description |
---|---|
PipelineRunResponse
|
The updated run model. |
Source code in src/zenml/zen_server/routers/runs_endpoints.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
schedule_endpoints
Endpoint definitions for pipeline run schedules.
create_schedule(schedule: ScheduleRequest, project_name_or_id: Optional[Union[str, UUID]] = None, auth_context: AuthContext = Security(authorize)) -> ScheduleResponse
Creates a schedule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule
|
ScheduleRequest
|
Schedule to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
ScheduleResponse
|
The created schedule. |
Source code in src/zenml/zen_server/routers/schedule_endpoints.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
delete_schedule(schedule_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific schedule using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id
|
UUID
|
ID of the schedule to delete. |
required |
Source code in src/zenml/zen_server/routers/schedule_endpoints.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
get_schedule(schedule_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ScheduleResponse
Gets a specific schedule using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id
|
UUID
|
ID of the schedule to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ScheduleResponse
|
A specific schedule object. |
Source code in src/zenml/zen_server/routers/schedule_endpoints.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
list_schedules(schedule_filter_model: ScheduleFilter = Depends(make_dependable(ScheduleFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ScheduleResponse]
Gets a list of schedules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_filter_model
|
ScheduleFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(ScheduleFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ScheduleResponse]
|
List of schedule objects. |
Source code in src/zenml/zen_server/routers/schedule_endpoints.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
update_schedule(schedule_id: UUID, schedule_update: ScheduleUpdate, _: AuthContext = Security(authorize)) -> ScheduleResponse
Updates the attribute on a specific schedule using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_id
|
UUID
|
ID of the schedule to get. |
required |
schedule_update
|
ScheduleUpdate
|
the model containing the attributes to update. |
required |
Returns:
Type | Description |
---|---|
ScheduleResponse
|
The updated schedule object. |
Source code in src/zenml/zen_server/routers/schedule_endpoints.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
secrets_endpoints
Endpoint definitions for pipeline run secrets.
backup_secrets(ignore_errors: bool = True, delete_secrets: bool = False, _: AuthContext = Security(authorize)) -> None
Backs up all secrets in the secrets store to the backup secrets store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore_errors
|
bool
|
Whether to ignore individual errors when backing up secrets and continue with the backup operation until all secrets have been backed up. |
True
|
delete_secrets
|
bool
|
Whether to delete the secrets that have been successfully backed up from the primary secrets store. Setting this flag effectively moves all secrets from the primary secrets store to the backup secrets store. |
False
|
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
create_secret(secret: SecretRequest, workspace_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> SecretResponse
Creates a secret.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret
|
SecretRequest
|
Secret to create. |
required |
workspace_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the workspace. |
None
|
Returns:
Type | Description |
---|---|
SecretResponse
|
The created secret. |
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
delete_secret(secret_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific secret using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret_id
|
UUID
|
ID of the secret to delete. |
required |
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
get_secret(secret_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> SecretResponse
Gets a specific secret using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret_id
|
UUID
|
ID of the secret to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
SecretResponse
|
A specific secret object. |
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
list_secrets(secret_filter_model: SecretFilter = Depends(make_dependable(SecretFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[SecretResponse]
Gets a list of secrets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret_filter_model
|
SecretFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(SecretFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[SecretResponse]
|
List of secret objects. |
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
restore_secrets(ignore_errors: bool = False, delete_secrets: bool = False, _: AuthContext = Security(authorize)) -> None
Restores all secrets from the backup secrets store into the main secrets store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore_errors
|
bool
|
Whether to ignore individual errors when restoring secrets and continue with the restore operation until all secrets have been restored. |
False
|
delete_secrets
|
bool
|
Whether to delete the secrets that have been successfully restored from the backup secrets store. Setting this flag effectively moves all secrets from the backup secrets store to the primary secrets store. |
False
|
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
update_secret(secret_id: UUID, secret_update: SecretUpdate, patch_values: Optional[bool] = False, _: AuthContext = Security(authorize)) -> SecretResponse
Updates the attribute on a specific secret using its unique id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret_id
|
UUID
|
ID of the secret to get. |
required |
secret_update
|
SecretUpdate
|
the model containing the attributes to update. |
required |
patch_values
|
Optional[bool]
|
Whether to patch the secret values or replace them. |
False
|
Returns:
Type | Description |
---|---|
SecretResponse
|
The updated secret object. |
Source code in src/zenml/zen_server/routers/secrets_endpoints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
server_endpoints
Endpoint definitions for authentication (login).
activate_server(activate_request: ServerActivationRequest) -> Optional[UserResponse]
Updates a stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activate_request
|
ServerActivationRequest
|
The request to activate the server. |
required |
Returns:
Type | Description |
---|---|
Optional[UserResponse]
|
The default admin user that was created during activation, if any. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
get_onboarding_state(_: AuthContext = Security(authorize)) -> List[str]
Get the onboarding state of the server.
Returns:
Type | Description |
---|---|
List[str]
|
The onboarding state of the server. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
get_server_statistics(auth_context: AuthContext = Security(authorize)) -> ServerStatistics
Gets server statistics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
ServerStatistics
|
Statistics of the server. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
get_settings(_: AuthContext = Security(authorize), hydrate: bool = True) -> ServerSettingsResponse
Get settings of the server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hydrate
|
bool
|
Whether to hydrate the response. |
True
|
Returns:
Type | Description |
---|---|
ServerSettingsResponse
|
Settings of the server. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
server_info() -> ServerModel
Get information about the server.
Returns:
Type | Description |
---|---|
ServerModel
|
Information about the server. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
68 69 70 71 72 73 74 75 76 77 78 79 |
|
server_load_info(_: AuthContext = Security(authorize)) -> ServerLoadInfo
Get information about the server load.
Returns:
Type | Description |
---|---|
ServerLoadInfo
|
Information about the server load. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
update_server_settings(settings_update: ServerSettingsUpdate, auth_context: AuthContext = Security(authorize)) -> ServerSettingsResponse
Updates the settings of the server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings_update
|
ServerSettingsUpdate
|
Settings update. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Raises:
Type | Description |
---|---|
IllegalOperationError
|
If trying to update admin properties without admin permissions. |
Returns:
Type | Description |
---|---|
ServerSettingsResponse
|
The updated settings. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
version() -> str
Get version of the server.
Returns:
Type | Description |
---|---|
str
|
String representing the version of the server. |
Source code in src/zenml/zen_server/routers/server_endpoints.py
58 59 60 61 62 63 64 65 |
|
service_accounts_endpoints
Endpoint definitions for API keys.
create_api_key(service_account_id: UUID, api_key: APIKeyRequest, _: AuthContext = Security(authorize)) -> APIKeyResponse
Creates an API key for a service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account for which to create the API key. |
required |
api_key
|
APIKeyRequest
|
API key to create. |
required |
Returns:
Type | Description |
---|---|
APIKeyResponse
|
The created API key. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
create_service_account(service_account: ServiceAccountRequest, _: AuthContext = Security(authorize)) -> ServiceAccountResponse
Creates a service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account
|
ServiceAccountRequest
|
Service account to create. |
required |
Returns:
Type | Description |
---|---|
ServiceAccountResponse
|
The created service account. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
delete_api_key(service_account_id: UUID, api_key_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Deletes an API key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account to which the API key belongs. |
required |
api_key_name_or_id
|
Union[str, UUID]
|
Name or ID of the API key to delete. |
required |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
delete_service_account(service_account_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Delete a specific service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_name_or_id
|
Union[str, UUID]
|
Name or ID of the service account. |
required |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_api_key(service_account_id: UUID, api_key_name_or_id: Union[str, UUID], hydrate: bool = True, _: AuthContext = Security(authorize)) -> APIKeyResponse
Returns the requested API key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account to which the API key belongs. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
api_key_name_or_id
|
Union[str, UUID]
|
Name or ID of the API key to return. |
required |
Returns:
Type | Description |
---|---|
APIKeyResponse
|
The requested API key. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
|
get_service_account(service_account_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize), hydrate: bool = True) -> ServiceAccountResponse
Returns a specific service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_name_or_id
|
Union[str, UUID]
|
Name or ID of the service account. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ServiceAccountResponse
|
The service account matching the given name or ID. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
list_api_keys(service_account_id: UUID, filter_model: APIKeyFilter = Depends(make_dependable(APIKeyFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[APIKeyResponse]
List API keys associated with a service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account to which the API keys belong. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
filter_model
|
APIKeyFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(APIKeyFilter))
|
Returns:
Type | Description |
---|---|
Page[APIKeyResponse]
|
All API keys matching the filter and associated with the supplied |
Page[APIKeyResponse]
|
service account. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
list_service_accounts(filter_model: ServiceAccountFilter = Depends(make_dependable(ServiceAccountFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ServiceAccountResponse]
Returns a list of service accounts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
ServiceAccountFilter
|
Model that takes care of filtering, sorting and pagination. |
Depends(make_dependable(ServiceAccountFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ServiceAccountResponse]
|
A list of service accounts matching the filter. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
rotate_api_key(service_account_id: UUID, api_key_name_or_id: Union[str, UUID], rotate_request: APIKeyRotateRequest, _: AuthContext = Security(authorize)) -> APIKeyResponse
Rotate an API key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account to which the API key belongs. |
required |
api_key_name_or_id
|
Union[str, UUID]
|
Name or ID of the API key to rotate. |
required |
rotate_request
|
APIKeyRotateRequest
|
API key rotation request. |
required |
Returns:
Type | Description |
---|---|
APIKeyResponse
|
The updated API key. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
update_api_key(service_account_id: UUID, api_key_name_or_id: Union[str, UUID], api_key_update: APIKeyUpdate, _: AuthContext = Security(authorize)) -> APIKeyResponse
Updates an API key for a service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_id
|
UUID
|
ID of the service account to which the API key belongs. |
required |
api_key_name_or_id
|
Union[str, UUID]
|
Name or ID of the API key to update. |
required |
api_key_update
|
APIKeyUpdate
|
API key update. |
required |
Returns:
Type | Description |
---|---|
APIKeyResponse
|
The updated API key. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
|
update_service_account(service_account_name_or_id: Union[str, UUID], service_account_update: ServiceAccountUpdate, _: AuthContext = Security(authorize)) -> ServiceAccountResponse
Updates a specific service account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_account_name_or_id
|
Union[str, UUID]
|
Name or ID of the service account. |
required |
service_account_update
|
ServiceAccountUpdate
|
the service account to use for the update. |
required |
Returns:
Type | Description |
---|---|
ServiceAccountResponse
|
The updated service account. |
Source code in src/zenml/zen_server/routers/service_accounts_endpoints.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
service_connectors_endpoints
Endpoint definitions for service connectors.
create_service_connector(connector: ServiceConnectorRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> ServiceConnectorResponse
Creates a service connector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector
|
ServiceConnectorRequest
|
Service connector to register. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
ServiceConnectorResponse
|
The created service connector. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
delete_service_connector(connector_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a service connector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_id
|
UUID
|
ID of the service connector. |
required |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
get_resources_based_on_service_connector_info(connector_info: Optional[ServiceConnectorInfo] = None, connector_uuid: Optional[UUID] = None, _: AuthContext = Security(authorize)) -> ServiceConnectorResourcesInfo
Gets the list of resources that a service connector can access.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_info
|
Optional[ServiceConnectorInfo]
|
The service connector info. |
None
|
connector_uuid
|
Optional[UUID]
|
The service connector uuid. |
None
|
Returns:
Type | Description |
---|---|
ServiceConnectorResourcesInfo
|
The list of resources that the service connector configuration has |
ServiceConnectorResourcesInfo
|
access to and consumable from UI/CLI. |
Raises:
Type | Description |
---|---|
ValueError
|
If both connector_info and connector_uuid are provided. |
ValueError
|
If neither connector_info nor connector_uuid are provided. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
|
get_service_connector(connector_id: UUID, expand_secrets: bool = True, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ServiceConnectorResponse
Returns the requested service connector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_id
|
UUID
|
ID of the service connector. |
required |
expand_secrets
|
bool
|
Whether to expand secrets or not. |
True
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ServiceConnectorResponse
|
The requested service connector. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
get_service_connector_client(connector_id: UUID, resource_type: Optional[str] = None, resource_id: Optional[str] = None, _: AuthContext = Security(authorize)) -> ServiceConnectorResponse
Get a service connector client for a service connector and given resource.
This requires the service connector implementation to be installed on the ZenML server, otherwise a 501 Not Implemented error will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_id
|
UUID
|
ID of the service connector. |
required |
resource_type
|
Optional[str]
|
Type of the resource to list. |
None
|
resource_id
|
Optional[str]
|
ID of the resource to list. |
None
|
Returns:
Type | Description |
---|---|
ServiceConnectorResponse
|
A service connector client that can be used to access the given |
ServiceConnectorResponse
|
resource. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
|
get_service_connector_type(connector_type: str, _: AuthContext = Security(authorize)) -> ServiceConnectorTypeModel
Returns the requested service connector type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_type
|
str
|
the service connector type identifier. |
required |
Returns:
Type | Description |
---|---|
ServiceConnectorTypeModel
|
The requested service connector type. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
|
list_service_connector_resources(filter_model: ServiceConnectorFilter = Depends(make_dependable(ServiceConnectorFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, auth_context: AuthContext = Security(authorize)) -> List[ServiceConnectorResourcesModel]
List resources that can be accessed by service connectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
ServiceConnectorFilter
|
The filter model to use when fetching service connectors. |
Depends(make_dependable(ServiceConnectorFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
List[ServiceConnectorResourcesModel]
|
The matching list of resources that available service |
List[ServiceConnectorResourcesModel]
|
connectors have access to. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
list_service_connector_types(connector_type: Optional[str] = None, resource_type: Optional[str] = None, auth_method: Optional[str] = None, _: AuthContext = Security(authorize)) -> List[ServiceConnectorTypeModel]
Get a list of service connector types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_type
|
Optional[str]
|
Filter by connector type. |
None
|
resource_type
|
Optional[str]
|
Filter by resource type. |
None
|
auth_method
|
Optional[str]
|
Filter by auth method. |
None
|
Returns:
Type | Description |
---|---|
List[ServiceConnectorTypeModel]
|
List of service connector types. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
|
list_service_connectors(connector_filter_model: ServiceConnectorFilter = Depends(make_dependable(ServiceConnectorFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, expand_secrets: bool = True, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ServiceConnectorResponse]
Get a list of all service connectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_filter_model
|
ServiceConnectorFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(ServiceConnectorFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
expand_secrets
|
bool
|
Whether to expand secrets or not. |
True
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ServiceConnectorResponse]
|
Page with list of service connectors matching the filter criteria. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
update_service_connector(connector_id: UUID, connector_update: ServiceConnectorUpdate, _: AuthContext = Security(authorize)) -> ServiceConnectorResponse
Updates a service connector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_id
|
UUID
|
ID of the service connector. |
required |
connector_update
|
ServiceConnectorUpdate
|
Service connector to use to update. |
required |
Returns:
Type | Description |
---|---|
ServiceConnectorResponse
|
Updated service connector. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
validate_and_verify_service_connector(connector_id: UUID, resource_type: Optional[str] = None, resource_id: Optional[str] = None, list_resources: bool = True, _: AuthContext = Security(authorize)) -> ServiceConnectorResourcesModel
Verifies if a service connector instance has access to one or more resources.
This requires the service connector implementation to be installed on the ZenML server, otherwise a 501 Not Implemented error will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector_id
|
UUID
|
The ID of the service connector to verify. |
required |
resource_type
|
Optional[str]
|
The type of resource to verify access to. |
None
|
resource_id
|
Optional[str]
|
The ID of the resource to verify access to. |
None
|
list_resources
|
bool
|
If True, the list of all resources accessible through the service connector and matching the supplied resource type and ID are returned. |
True
|
Returns:
Type | Description |
---|---|
ServiceConnectorResourcesModel
|
The list of resources that the service connector has access to, scoped |
ServiceConnectorResourcesModel
|
to the supplied resource type and ID, if provided. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
validate_and_verify_service_connector_config(connector: ServiceConnectorRequest, list_resources: bool = True, _: AuthContext = Security(authorize)) -> ServiceConnectorResourcesModel
Verifies if a service connector configuration has access to resources.
This requires the service connector implementation to be installed on the ZenML server, otherwise a 501 Not Implemented error will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connector
|
ServiceConnectorRequest
|
The service connector configuration to verify. |
required |
list_resources
|
bool
|
If True, the list of all resources accessible through the service connector is returned. |
True
|
Returns:
Type | Description |
---|---|
ServiceConnectorResourcesModel
|
The list of resources that the service connector configuration has |
ServiceConnectorResourcesModel
|
access to. |
Source code in src/zenml/zen_server/routers/service_connectors_endpoints.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
service_endpoints
Endpoint definitions for services.
create_service(service: ServiceRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> ServiceResponse
Creates a new service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
ServiceRequest
|
The service to create. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
ServiceResponse
|
The created service. |
Source code in src/zenml/zen_server/routers/service_endpoints.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
delete_service(service_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a specific service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_id
|
UUID
|
The ID of the service to delete. |
required |
Source code in src/zenml/zen_server/routers/service_endpoints.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
get_service(service_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ServiceResponse
Gets a specific service using its unique ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_id
|
UUID
|
The ID of the service to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ServiceResponse
|
A specific service object. |
Source code in src/zenml/zen_server/routers/service_endpoints.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
list_services(filter_model: ServiceFilter = Depends(make_dependable(ServiceFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ServiceResponse]
Gets a page of service objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
ServiceFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ServiceFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ServiceResponse]
|
Page of service objects. |
Source code in src/zenml/zen_server/routers/service_endpoints.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
update_service(service_id: UUID, update: ServiceUpdate, _: AuthContext = Security(authorize)) -> ServiceResponse
Updates a service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_id
|
UUID
|
The ID of the service to update. |
required |
update
|
ServiceUpdate
|
The model containing the attributes to update. |
required |
Returns:
Type | Description |
---|---|
ServiceResponse
|
The updated service object. |
Source code in src/zenml/zen_server/routers/service_endpoints.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
stack_components_endpoints
Endpoint definitions for stack components.
create_stack_component(component: ComponentRequest, project_name_or_id: Optional[Union[str, UUID]] = None, _: AuthContext = Security(authorize)) -> ComponentResponse
Creates a stack component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component
|
ComponentRequest
|
Stack component to register. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
Returns:
Type | Description |
---|---|
ComponentResponse
|
The created stack component. |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
deregister_stack_component(component_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a stack component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component_id
|
UUID
|
ID of the stack component. |
required |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
get_stack_component(component_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> ComponentResponse
Returns the requested stack component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component_id
|
UUID
|
ID of the stack component. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
ComponentResponse
|
The requested stack component. |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
get_stack_component_types(_: AuthContext = Security(authorize)) -> List[str]
Get a list of all stack component types.
Returns:
Type | Description |
---|---|
List[str]
|
List of stack components. |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
list_stack_components(component_filter_model: ComponentFilter = Depends(make_dependable(ComponentFilter)), project_name_or_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[ComponentResponse]
Get a list of all stack components.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component_filter_model
|
ComponentFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(ComponentFilter))
|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[ComponentResponse]
|
List of stack components matching the filter criteria. |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
update_stack_component(component_id: UUID, component_update: ComponentUpdate, _: AuthContext = Security(authorize)) -> ComponentResponse
Updates a stack component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component_id
|
UUID
|
ID of the stack component. |
required |
component_update
|
ComponentUpdate
|
Stack component to use to update. |
required |
Returns:
Type | Description |
---|---|
ComponentResponse
|
Updated stack component. |
Source code in src/zenml/zen_server/routers/stack_components_endpoints.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
stack_deployment_endpoints
Endpoint definitions for stack deployments.
get_deployed_stack(provider: StackDeploymentProvider, stack_name: str, location: Optional[str] = None, date_start: Optional[datetime.datetime] = None, terraform: bool = False, _: AuthContext = Security(authorize)) -> Optional[DeployedStack]
Return a matching ZenML stack that was deployed and registered.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider
|
StackDeploymentProvider
|
The stack deployment provider. |
required |
stack_name
|
str
|
The name of the stack. |
required |
location
|
Optional[str]
|
The location where the stack should be deployed. |
None
|
date_start
|
Optional[datetime]
|
The date when the deployment started. |
None
|
terraform
|
bool
|
Whether the stack was deployed using Terraform. |
False
|
Returns:
Type | Description |
---|---|
Optional[DeployedStack]
|
The ZenML stack that was deployed and registered or None if the stack |
Optional[DeployedStack]
|
was not found. |
Source code in src/zenml/zen_server/routers/stack_deployment_endpoints.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
get_stack_deployment_config(request: Request, provider: StackDeploymentProvider, stack_name: str, location: Optional[str] = None, terraform: bool = False, auth_context: AuthContext = Security(authorize)) -> StackDeploymentConfig
Return the URL to deploy the ZenML stack to the specified cloud provider.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The FastAPI request object. |
required |
provider
|
StackDeploymentProvider
|
The stack deployment provider. |
required |
stack_name
|
str
|
The name of the stack. |
required |
location
|
Optional[str]
|
The location where the stack should be deployed. |
None
|
terraform
|
bool
|
Whether the stack should be deployed using Terraform. |
False
|
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
StackDeploymentConfig
|
The cloud provider console URL where the stack will be deployed and |
StackDeploymentConfig
|
the configuration for the stack deployment. |
Source code in src/zenml/zen_server/routers/stack_deployment_endpoints.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
get_stack_deployment_info(provider: StackDeploymentProvider, _: AuthContext = Security(authorize)) -> StackDeploymentInfo
Get information about a stack deployment provider.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider
|
StackDeploymentProvider
|
The stack deployment provider. |
required |
Returns:
Type | Description |
---|---|
StackDeploymentInfo
|
Information about the stack deployment provider. |
Source code in src/zenml/zen_server/routers/stack_deployment_endpoints.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
stacks_endpoints
Endpoint definitions for stacks.
create_stack(stack: StackRequest, project_name_or_id: Optional[Union[str, UUID]] = None, auth_context: AuthContext = Security(authorize)) -> StackResponse
Creates a stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack
|
StackRequest
|
Stack to register. |
required |
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project. |
None
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
StackResponse
|
The created stack. |
Source code in src/zenml/zen_server/routers/stacks_endpoints.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
delete_stack(stack_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack_id
|
UUID
|
Name of the stack. |
required |
Source code in src/zenml/zen_server/routers/stacks_endpoints.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
get_stack(stack_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> StackResponse
Returns the requested stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack_id
|
UUID
|
ID of the stack. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
StackResponse
|
The requested stack. |
Source code in src/zenml/zen_server/routers/stacks_endpoints.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
list_stacks(project_name_or_id: Optional[Union[str, UUID]] = None, stack_filter_model: StackFilter = Depends(make_dependable(StackFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[StackResponse]
Returns all stacks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name_or_id
|
Optional[Union[str, UUID]]
|
Optional name or ID of the project to filter by. |
None
|
stack_filter_model
|
StackFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(StackFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[StackResponse]
|
All stacks matching the filter criteria. |
Source code in src/zenml/zen_server/routers/stacks_endpoints.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
update_stack(stack_id: UUID, stack_update: StackUpdate, _: AuthContext = Security(authorize)) -> StackResponse
Updates a stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack_id
|
UUID
|
Name of the stack. |
required |
stack_update
|
StackUpdate
|
Stack to use for the update. |
required |
Returns:
Type | Description |
---|---|
StackResponse
|
The updated stack. |
Source code in src/zenml/zen_server/routers/stacks_endpoints.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
steps_endpoints
Endpoint definitions for steps (and artifacts) of pipeline runs.
create_run_step(step: StepRunRequest, _: AuthContext = Security(authorize)) -> StepRunResponse
Create a run step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step
|
StepRunRequest
|
The run step to create. |
required |
_
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
StepRunResponse
|
The created run step. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
get_step(step_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> StepRunResponse
Get one specific step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_id
|
UUID
|
ID of the step to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
StepRunResponse
|
The step. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
get_step_configuration(step_id: UUID, _: AuthContext = Security(authorize)) -> Dict[str, Any]
Get the configuration of a specific step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_id
|
UUID
|
ID of the step to get. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The step configuration. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
get_step_logs(step_id: UUID, offset: int = 0, length: int = 1024 * 1024 * 16, _: AuthContext = Security(authorize)) -> str
Get the logs of a specific step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_id
|
UUID
|
ID of the step for which to get the logs. |
required |
offset
|
int
|
The offset from which to start reading. |
0
|
length
|
int
|
The amount of bytes that should be read. |
1024 * 1024 * 16
|
Returns:
Type | Description |
---|---|
str
|
The logs of the step. |
Raises:
Type | Description |
---|---|
HTTPException
|
If no logs are available for this step. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
get_step_status(step_id: UUID, _: AuthContext = Security(authorize)) -> ExecutionStatus
Get the status of a specific step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_id
|
UUID
|
ID of the step for which to get the status. |
required |
Returns:
Type | Description |
---|---|
ExecutionStatus
|
The status of the step. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
list_run_steps(step_run_filter_model: StepRunFilter = Depends(make_dependable(StepRunFilter)), hydrate: bool = False, auth_context: AuthContext = Security(authorize)) -> Page[StepRunResponse]
Get run steps according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_run_filter_model
|
StepRunFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(StepRunFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
Page[StepRunResponse]
|
The run steps according to query filters. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
update_step(step_id: UUID, step_model: StepRunUpdate, _: AuthContext = Security(authorize)) -> StepRunResponse
Updates a step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step_id
|
UUID
|
ID of the step. |
required |
step_model
|
StepRunUpdate
|
Step model to use for the update. |
required |
Returns:
Type | Description |
---|---|
StepRunResponse
|
The updated step model. |
Source code in src/zenml/zen_server/routers/steps_endpoints.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
tag_resource_endpoints
Endpoint definitions for the link between tags and resources.
batch_create_tag_resource(tag_resources: List[TagResourceRequest], _: AuthContext = Security(authorize)) -> List[TagResourceResponse]
Attach different tags to different resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_resources
|
List[TagResourceRequest]
|
A list of tag resource requests. |
required |
Returns:
Type | Description |
---|---|
List[TagResourceResponse]
|
A list of tag resource responses. |
Source code in src/zenml/zen_server/routers/tag_resource_endpoints.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
batch_delete_tag_resource(tag_resources: List[TagResourceRequest], _: AuthContext = Security(authorize)) -> None
Detach different tags from different resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_resources
|
List[TagResourceRequest]
|
A list of tag resource requests. |
required |
Source code in src/zenml/zen_server/routers/tag_resource_endpoints.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
create_tag_resource(tag_resource: TagResourceRequest, _: AuthContext = Security(authorize)) -> TagResourceResponse
Attach different tags to different resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_resource
|
TagResourceRequest
|
A tag resource request. |
required |
Returns:
Type | Description |
---|---|
TagResourceResponse
|
A tag resource response. |
Source code in src/zenml/zen_server/routers/tag_resource_endpoints.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
delete_tag_resource(tag_resource: TagResourceRequest, _: AuthContext = Security(authorize)) -> None
Detach a tag from a resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_resource
|
TagResourceRequest
|
The tag resource relationship to delete. |
required |
Source code in src/zenml/zen_server/routers/tag_resource_endpoints.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
tags_endpoints
Endpoint definitions for tags.
create_tag(tag: TagRequest, _: AuthContext = Security(authorize)) -> TagResponse
Create a new tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag
|
TagRequest
|
The tag to create. |
required |
Returns:
Type | Description |
---|---|
TagResponse
|
The created tag. |
Source code in src/zenml/zen_server/routers/tags_endpoints.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
delete_tag(tag_name_or_id: Union[str, UUID], _: AuthContext = Security(authorize)) -> None
Delete a tag by name or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_name_or_id
|
Union[str, UUID]
|
The name or ID of the tag to delete. |
required |
Source code in src/zenml/zen_server/routers/tags_endpoints.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
get_tag(tag_name_or_id: Union[str, UUID], hydrate: bool = True, _: AuthContext = Security(authorize)) -> TagResponse
Get a tag by name or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_name_or_id
|
Union[str, UUID]
|
The name or ID of the tag to get. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
TagResponse
|
The tag with the given name or ID. |
Source code in src/zenml/zen_server/routers/tags_endpoints.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
list_tags(tag_filter_model: TagFilter = Depends(make_dependable(TagFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[TagResponse]
Get tags according to query filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_filter_model
|
TagFilter
|
Filter model used for pagination, sorting, filtering |
Depends(make_dependable(TagFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[TagResponse]
|
The tags according to query filters. |
Source code in src/zenml/zen_server/routers/tags_endpoints.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
update_tag(tag_id: UUID, tag_update_model: TagUpdate, _: AuthContext = Security(authorize)) -> TagResponse
Updates a tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_id
|
UUID
|
Id or name of the tag. |
required |
tag_update_model
|
TagUpdate
|
Tag to use for the update. |
required |
Returns:
Type | Description |
---|---|
TagResponse
|
The updated tag. |
Source code in src/zenml/zen_server/routers/tags_endpoints.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
triggers_endpoints
Endpoint definitions for triggers.
create_trigger(trigger: TriggerRequest, _: AuthContext = Security(authorize)) -> TriggerResponse
Creates a trigger.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger
|
TriggerRequest
|
Trigger to register. |
required |
Returns:
Type | Description |
---|---|
TriggerResponse
|
The created trigger. |
Raises:
Type | Description |
---|---|
ValueError
|
If the action flavor/subtype combination is not actually a webhook event source |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
delete_trigger(trigger_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a trigger.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_id
|
UUID
|
Name of the trigger. |
required |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
delete_trigger_execution(trigger_execution_id: UUID, _: AuthContext = Security(authorize)) -> None
Deletes a trigger execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_execution_id
|
UUID
|
ID of the trigger execution. |
required |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
get_trigger(trigger_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> TriggerResponse
Returns the requested trigger.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_id
|
UUID
|
ID of the trigger. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
TriggerResponse
|
The requested trigger. |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
get_trigger_execution(trigger_execution_id: UUID, hydrate: bool = True, _: AuthContext = Security(authorize)) -> TriggerExecutionResponse
Returns the requested trigger execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_execution_id
|
UUID
|
ID of the trigger execution. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
Returns:
Type | Description |
---|---|
TriggerExecutionResponse
|
The requested trigger execution. |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
list_trigger_executions(trigger_execution_filter_model: TriggerExecutionFilter = Depends(make_dependable(TriggerExecutionFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[TriggerExecutionResponse]
List trigger executions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_execution_filter_model
|
TriggerExecutionFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(TriggerExecutionFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[TriggerExecutionResponse]
|
Page of trigger executions. |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
list_triggers(trigger_filter_model: TriggerFilter = Depends(make_dependable(TriggerFilter)), hydrate: bool = False, _: AuthContext = Security(authorize)) -> Page[TriggerResponse]
Returns all triggers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_filter_model
|
TriggerFilter
|
Filter model used for pagination, sorting, filtering. |
Depends(make_dependable(TriggerFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
Returns:
Type | Description |
---|---|
Page[TriggerResponse]
|
All triggers. |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
update_trigger(trigger_id: UUID, trigger_update: TriggerUpdate, _: AuthContext = Security(authorize)) -> TriggerResponse
Updates a trigger.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_id
|
UUID
|
Name of the trigger. |
required |
trigger_update
|
TriggerUpdate
|
Trigger to use for the update. |
required |
Returns:
Type | Description |
---|---|
TriggerResponse
|
The updated trigger. |
Raises:
Type | Description |
---|---|
ValueError
|
If the action flavor/subtype combination is not actually a webhook event source |
Source code in src/zenml/zen_server/routers/triggers_endpoints.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
users_endpoints
Endpoint definitions for users.
activate_user(user_name_or_id: Union[str, UUID], user_update: UserUpdate) -> UserResponse
Activates a specific user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
user_update
|
UserUpdate
|
the user to use for the update. |
required |
Returns:
Type | Description |
---|---|
UserResponse
|
The updated user. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
create_user(user: UserRequest, auth_context: AuthContext = Security(authorize)) -> UserResponse
Creates a user.
noqa: DAR401
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserRequest
|
User to create. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The created user. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
deactivate_user(user_name_or_id: Union[str, UUID], auth_context: AuthContext = Security(authorize)) -> UserResponse
Deactivates a user and generates a new activation token for it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The generated activation token. |
Raises:
Type | Description |
---|---|
IllegalOperationError
|
if the user is trying to deactivate themselves. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
delete_user(user_name_or_id: Union[str, UUID], auth_context: AuthContext = Security(authorize)) -> None
Deletes a specific user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Raises:
Type | Description |
---|---|
IllegalOperationError
|
If the user is not authorized to delete the user. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
email_opt_in_response(user_name_or_id: Union[str, UUID], user_response: UserUpdate, auth_context: AuthContext = Security(authorize)) -> UserResponse
Sets the response of the user to the email prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
user_response
|
UserUpdate
|
User Response to email prompt |
required |
auth_context
|
AuthContext
|
The authentication context of the user |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The updated user. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
if the user does not have the required permissions |
Source code in src/zenml/zen_server/routers/users_endpoints.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
|
get_current_user(auth_context: AuthContext = Security(authorize)) -> UserResponse
Returns the model of the authenticated user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The model of the authenticated user. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
|
get_user(user_name_or_id: Union[str, UUID], hydrate: bool = True, auth_context: AuthContext = Security(authorize)) -> UserResponse
Returns a specific user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
True
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
A specific user. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
list_users(user_filter_model: UserFilter = Depends(make_dependable(UserFilter)), hydrate: bool = False, auth_context: AuthContext = Security(authorize)) -> Page[UserResponse]
Returns a list of all users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_filter_model
|
UserFilter
|
Model that takes care of filtering, sorting and pagination. |
Depends(make_dependable(UserFilter))
|
hydrate
|
bool
|
Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. |
False
|
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
Page[UserResponse]
|
A list of all users. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
update_myself(user: UserUpdate, request: Request, auth_context: AuthContext = Security(authorize)) -> UserResponse
Updates a specific user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
UserUpdate
|
the user to use for the update. |
required |
request
|
Request
|
The request object. |
required |
auth_context
|
AuthContext
|
The authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The updated user. |
Raises:
Type | Description |
---|---|
IllegalOperationError
|
if the current password is not supplied when changing the password or if the current password is incorrect. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
|
update_user(user_name_or_id: Union[str, UUID], user_update: UserUpdate, request: Request, auth_context: AuthContext = Security(authorize)) -> UserResponse
Updates a specific user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
user_update
|
UserUpdate
|
the user to use for the update. |
required |
request
|
Request
|
The request object. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Returns:
Type | Description |
---|---|
UserResponse
|
The updated user. |
Raises:
Type | Description |
---|---|
IllegalOperationError
|
if the user tries change admin status, while not an admin, if the user tries to change the password of another user, or if the user tries to change their own password without providing the old password or providing an incorrect old password. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
|
update_user_resource_membership(user_name_or_id: Union[str, UUID], resource_type: str, resource_id: UUID, actions: List[str], auth_context: AuthContext = Security(authorize)) -> None
Updates resource memberships of a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name_or_id
|
Union[str, UUID]
|
Name or ID of the user. |
required |
resource_type
|
str
|
Type of the resource for which to update the membership. |
required |
resource_id
|
UUID
|
ID of the resource for which to update the membership. |
required |
actions
|
List[str]
|
List of actions that the user should be able to perform on the resource. If the user currently has permissions to perform actions which are not passed in this list, the permissions will be removed. |
required |
auth_context
|
AuthContext
|
Authentication context. |
Security(authorize)
|
Raises:
Type | Description |
---|---|
ValueError
|
If a user tries to update their own membership. |
KeyError
|
If no resource with the given type and ID exists. |
Source code in src/zenml/zen_server/routers/users_endpoints.py
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
|
webhook_endpoints
Endpoint definitions for webhooks.
get_body(request: Request) -> bytes
async
Get access to the raw body.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The request |
required |
Returns:
Type | Description |
---|---|
bytes
|
The raw request body. |
Source code in src/zenml/zen_server/routers/webhook_endpoints.py
42 43 44 45 46 47 48 49 50 51 |
|
webhook(event_source_id: UUID, request: Request, background_tasks: BackgroundTasks, raw_body: bytes = Depends(get_body)) -> Dict[str, str]
Webhook to receive events from external event sources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_source_id
|
UUID
|
The event_source_id |
required |
request
|
Request
|
The request object |
required |
background_tasks
|
BackgroundTasks
|
Background task handler |
required |
raw_body
|
bytes
|
The raw request body |
Depends(get_body)
|
Returns:
Type | Description |
---|---|
Dict[str, str]
|
Static dict stating that event is received. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
If the Event Source does not exist. |
KeyError
|
If no appropriate Plugin found in the plugin registry |
ValueError
|
If the id of the Event Source is not actually a webhook event source |
WebhookInactiveError
|
In case this webhook has been deactivated |
Source code in src/zenml/zen_server/routers/webhook_endpoints.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
secure_headers
Secure headers for the ZenML Server.
Functions
initialize_secure_headers() -> None
Initialize the secure headers component.
Source code in src/zenml/zen_server/secure_headers.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
secure_headers() -> secure.Secure
Return the secure headers component.
Returns:
Type | Description |
---|---|
Secure
|
The secure headers component. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the secure headers component is not initialized. |
Source code in src/zenml/zen_server/secure_headers.py
25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
template_execution
Modules
runner_entrypoint_configuration
Runner entrypoint configuration.
RunnerEntrypointConfiguration(arguments: List[str])
Bases: BaseEntrypointConfiguration
Runner entrypoint configuration.
Source code in src/zenml/entrypoints/base_entrypoint_configuration.py
60 61 62 63 64 65 66 |
|
run() -> None
Run the entrypoint configuration.
This method runs the pipeline defined by the deployment given as input to the entrypoint configuration.
Source code in src/zenml/zen_server/template_execution/runner_entrypoint_configuration.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
utils
Utility functions to run a pipeline from the server.
deployment_request_from_template(template: RunTemplateResponse, config: PipelineRunConfiguration, user_id: UUID) -> PipelineDeploymentRequest
Generate a deployment request from a template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
RunTemplateResponse
|
The template from which to create the deployment request. |
required |
config
|
PipelineRunConfiguration
|
The run configuration. |
required |
user_id
|
UUID
|
ID of the user that is trying to run the template. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If there are missing/extra step parameters in the run configuration. |
Returns:
Type | Description |
---|---|
PipelineDeploymentRequest
|
The generated deployment request. |
Source code in src/zenml/zen_server/template_execution/utils.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
|
ensure_async_orchestrator(deployment: PipelineDeploymentRequest, stack: StackResponse) -> None
Ensures the orchestrator is configured to run async.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentRequest
|
Deployment request in which the orchestrator configuration should be updated to ensure the orchestrator is running async. |
required |
stack
|
StackResponse
|
The stack on which the deployment will run. |
required |
Source code in src/zenml/zen_server/template_execution/utils.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
generate_dockerfile(pypi_requirements: List[str], apt_packages: List[str], zenml_version: str, python_version: str) -> str
Generate a Dockerfile that installs the requirements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pypi_requirements
|
List[str]
|
The PyPI requirements to install. |
required |
apt_packages
|
List[str]
|
The APT packages to install. |
required |
zenml_version
|
str
|
The ZenML version to use as parent image. |
required |
python_version
|
str
|
The Python version to use as parent image. |
required |
Returns:
Type | Description |
---|---|
str
|
The Dockerfile. |
Source code in src/zenml/zen_server/template_execution/utils.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
|
generate_image_hash(dockerfile: str) -> str
Generate a hash of the Dockerfile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dockerfile
|
str
|
The Dockerfile for which to generate the hash. |
required |
Returns:
Type | Description |
---|---|
str
|
The hash of the Dockerfile. |
Source code in src/zenml/zen_server/template_execution/utils.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
get_pipeline_run_analytics_metadata(deployment: PipelineDeploymentResponse, stack: StackResponse, template_id: UUID, run_id: UUID) -> Dict[str, Any]
Get metadata for the pipeline run analytics event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The deployment of the run. |
required |
stack
|
StackResponse
|
The stack on which the run will happen. |
required |
template_id
|
UUID
|
ID of the template from which the run was started. |
required |
run_id
|
UUID
|
ID of the run. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The analytics metadata. |
Source code in src/zenml/zen_server/template_execution/utils.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
|
run_template(template: RunTemplateResponse, auth_context: AuthContext, background_tasks: Optional[BackgroundTasks] = None, run_config: Optional[PipelineRunConfiguration] = None) -> PipelineRunResponse
Run a pipeline from a template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
RunTemplateResponse
|
The template to run. |
required |
auth_context
|
AuthContext
|
Authentication context. |
required |
background_tasks
|
Optional[BackgroundTasks]
|
Background tasks. |
None
|
run_config
|
Optional[PipelineRunConfiguration]
|
The run configuration. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If the template can not be run. |
RuntimeError
|
If the server URL is not set in the server configuration. |
Returns:
Type | Description |
---|---|
PipelineRunResponse
|
ID of the new pipeline run. |
Source code in src/zenml/zen_server/template_execution/utils.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
workload_manager_interface
Workload manager interface definition.
WorkloadManagerInterface
Bases: ABC
Workload manager interface.
build_and_push_image(workload_id: UUID, dockerfile: str, image_name: str, sync: bool = True, timeout_in_seconds: int = 0) -> str
abstractmethod
Build and push a Docker image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workload_id
|
UUID
|
Workload ID. |
required |
dockerfile
|
str
|
The dockerfile content to build the image. |
required |
image_name
|
str
|
The image repository and tag. |
required |
sync
|
bool
|
If True, will wait until the build finished before returning. |
True
|
timeout_in_seconds
|
int
|
Timeout in seconds to wait before cancelling the container. If set to 0 the container will run until it fails or finishes. |
0
|
Returns:
Type | Description |
---|---|
str
|
The full image name including container registry. |
Source code in src/zenml/zen_server/template_execution/workload_manager_interface.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
delete_workload(workload_id: UUID) -> None
abstractmethod
Delete a workload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workload_id
|
UUID
|
Workload ID. |
required |
Source code in src/zenml/zen_server/template_execution/workload_manager_interface.py
63 64 65 66 67 68 69 70 |
|
get_logs(workload_id: UUID) -> str
abstractmethod
Get logs for a workload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workload_id
|
UUID
|
Workload ID. |
required |
Returns:
Type | Description |
---|---|
str
|
The stored logs. |
Source code in src/zenml/zen_server/template_execution/workload_manager_interface.py
72 73 74 75 76 77 78 79 80 81 82 |
|
log(workload_id: UUID, message: str) -> None
abstractmethod
Log a message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workload_id
|
UUID
|
Workload ID. |
required |
message
|
str
|
The message to log. |
required |
Source code in src/zenml/zen_server/template_execution/workload_manager_interface.py
84 85 86 87 88 89 90 91 92 |
|
run(workload_id: UUID, image: str, command: List[str], arguments: List[str], environment: Optional[Dict[str, str]] = None, sync: bool = True, timeout_in_seconds: int = 0) -> None
abstractmethod
Run a Docker container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workload_id
|
UUID
|
Workload ID. |
required |
image
|
str
|
The Docker image to run. |
required |
command
|
List[str]
|
The command to run in the container. |
required |
arguments
|
List[str]
|
The arguments for the command. |
required |
environment
|
Optional[Dict[str, str]]
|
The environment to set in the container. |
None
|
sync
|
bool
|
If True, will wait until the container finished running before returning. |
True
|
timeout_in_seconds
|
int
|
Timeout in seconds to wait before cancelling the container. If set to 0 the container will run until it fails or finishes. |
0
|
Source code in src/zenml/zen_server/template_execution/workload_manager_interface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
utils
Util functions for the ZenML Server.
Classes
Functions
feature_gate() -> FeatureGateInterface
Return the initialized Feature Gate component.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the RBAC component is not initialized. |
Returns:
Type | Description |
---|---|
FeatureGateInterface
|
The RBAC component. |
Source code in src/zenml/zen_server/utils.py
131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
get_ip_location(ip_address: str) -> Tuple[str, str, str]
Get the location of the given IP address.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip_address
|
str
|
The IP address to get the location for. |
required |
Returns:
Type | Description |
---|---|
Tuple[str, str, str]
|
A tuple of city, region, country. |
Source code in src/zenml/zen_server/utils.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
get_zenml_headers() -> Dict[str, str]
Get the ZenML specific headers to be included in requests made by the server.
Returns:
Type | Description |
---|---|
Dict[str, str]
|
The ZenML specific headers. |
Source code in src/zenml/zen_server/utils.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
handle_exceptions(func: F) -> F
Decorator to handle exceptions in the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
F
|
Function to decorate. |
required |
Returns:
Type | Description |
---|---|
F
|
Decorated function. |
Source code in src/zenml/zen_server/utils.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
initialize_feature_gate() -> None
Initialize the Feature Gate component.
Source code in src/zenml/zen_server/utils.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
initialize_memcache(max_capacity: int, default_expiry: int) -> None
Initialize the memory cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_capacity
|
int
|
The maximum capacity of the cache. |
required |
default_expiry
|
int
|
The default expiry time in seconds. |
required |
Source code in src/zenml/zen_server/utils.py
228 229 230 231 232 233 234 235 236 |
|
initialize_plugins() -> None
Initialize the event plugins registry.
Source code in src/zenml/zen_server/utils.py
199 200 201 |
|
initialize_rbac() -> None
Initialize the RBAC component.
Source code in src/zenml/zen_server/utils.py
118 119 120 121 122 123 124 125 126 127 128 |
|
initialize_workload_manager() -> None
Initialize the workload manager component.
This does not fail if the source can't be loaded but only logs a warning.
Source code in src/zenml/zen_server/utils.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|
initialize_zen_store() -> None
Initialize the ZenML Store.
Raises:
Type | Description |
---|---|
ValueError
|
If the ZenML Store is using a REST back-end. |
Source code in src/zenml/zen_server/utils.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
is_same_or_subdomain(source_domain: str, target_domain: str) -> bool
Check if the source domain is the same or a subdomain of the target domain.
Examples:
is_same_or_subdomain("example.com", "example.com") -> True is_same_or_subdomain("alpha.example.com", "example.com") -> True is_same_or_subdomain("alpha.example.com", ".example.com") -> True is_same_or_subdomain("example.com", "alpha.example.com") -> False is_same_or_subdomain("alpha.beta.example.com", "beta.example.com") -> True is_same_or_subdomain("alpha.beta.example.com", "alpha.example.com") -> False is_same_or_subdomain("alphabeta.gamma.example", "beta.gamma.example") -> False
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_domain
|
str
|
The source domain to check. |
required |
target_domain
|
str
|
The target domain to compare against. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the source domain is the same or a subdomain of the target |
bool
|
domain, False otherwise. |
Source code in src/zenml/zen_server/utils.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
|
is_user_request(request: Request) -> bool
Determine if the incoming request is a user request.
This function checks various aspects of the request to determine if it's a user-initiated request or a system request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming FastAPI request object. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if it's a user request, False otherwise. |
Source code in src/zenml/zen_server/utils.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
make_dependable(cls: Type[BaseModel]) -> Callable[..., Any]
This function makes a pydantic model usable for fastapi query parameters.
Additionally, it converts InternalServerError
s that would happen due to
pydantic.ValidationError
into 422 responses that signal an invalid
request.
Check out https://github.com/tiangolo/fastapi/issues/1474 for context.
Usage
def f(model: Model = Depends(make_dependable(Model))): ...
UPDATE: Function from above mentioned Github issue was extended to support
multi-input parameters, e.g. tags: List[str]. It needs a default set to Query(
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls
|
Type[BaseModel]
|
The model class. |
required |
Returns:
Type | Description |
---|---|
Callable[..., Any]
|
Function to use in FastAPI |
Source code in src/zenml/zen_server/utils.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
memcache() -> MemoryCache
Return the memory cache.
Returns:
Type | Description |
---|---|
MemoryCache
|
The memory cache. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the memory cache is not initialized. |
Source code in src/zenml/zen_server/utils.py
239 240 241 242 243 244 245 246 247 248 249 250 |
|
plugin_flavor_registry() -> PluginFlavorRegistry
Get the plugin flavor registry.
Returns:
Type | Description |
---|---|
PluginFlavorRegistry
|
The plugin flavor registry. |
Source code in src/zenml/zen_server/utils.py
89 90 91 92 93 94 95 96 97 98 99 100 |
|
rbac() -> RBACInterface
Return the initialized RBAC component.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the RBAC component is not initialized. |
Returns:
Type | Description |
---|---|
RBACInterface
|
The RBAC component. |
Source code in src/zenml/zen_server/utils.py
103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
server_config() -> ServerConfiguration
Returns the ZenML Server configuration.
Returns:
Type | Description |
---|---|
ServerConfiguration
|
The ZenML Server configuration. |
Source code in src/zenml/zen_server/utils.py
256 257 258 259 260 261 262 263 264 265 |
|
set_filter_project_scope(filter_model: ProjectScopedFilter, project_name_or_id: Optional[Union[UUID, str]] = None) -> None
Set the project scope of the filter model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_model
|
ProjectScopedFilter
|
The filter model to set the scope for. |
required |
project_name_or_id
|
Optional[Union[UUID, str]]
|
The project to set the scope for. If not provided, the project scope is determined from the request project filter or the default project, in that order. |
None
|
Source code in src/zenml/zen_server/utils.py
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
|
verify_admin_status_if_no_rbac(admin_status: Optional[bool], action: Optional[str] = None) -> None
Validate the admin status for sensitive requests.
Only add this check in endpoints meant for admin use only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
admin_status
|
Optional[bool]
|
Whether the user is an admin or not. This is only used if explicitly specified in the call and even if passed will be ignored, if RBAC is enabled. |
required |
action
|
Optional[str]
|
The action that is being performed, used for output only. |
None
|
Raises:
Type | Description |
---|---|
IllegalOperationError
|
If the admin status is not valid. |
Source code in src/zenml/zen_server/utils.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
|
workload_manager() -> WorkloadManagerInterface
Return the initialized workload manager component.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the workload manager component is not initialized. |
Returns:
Type | Description |
---|---|
WorkloadManagerInterface
|
The workload manager component. |
Source code in src/zenml/zen_server/utils.py
162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
zen_store() -> SqlZenStore
Initialize the ZenML Store.
Returns:
Type | Description |
---|---|
SqlZenStore
|
The ZenML Store. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the ZenML Store has not been initialized. |
Source code in src/zenml/zen_server/utils.py
74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
zen_server_api
Zen Server API.
To run this file locally, execute:
```
uvicorn zenml.zen_server.zen_server_api:app --reload
```
Classes
RequestBodyLimit(app: ASGIApp, max_bytes: int)
Bases: BaseHTTPMiddleware
Limits the size of the request body.
Limits the size of the request body.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
ASGIApp
|
The FastAPI app. |
required |
max_bytes
|
int
|
The maximum size of the request body. |
required |
Source code in src/zenml/zen_server/zen_server_api.py
162 163 164 165 166 167 168 169 170 |
|
dispatch(request: Request, call_next: RequestResponseEndpoint) -> Response
async
Limits the size of the request body.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming request. |
required |
call_next
|
RequestResponseEndpoint
|
The next function to be called. |
required |
Returns:
Type | Description |
---|---|
Response
|
The response to the request. |
Source code in src/zenml/zen_server/zen_server_api.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
RestrictFileUploadsMiddleware(app: FastAPI, allowed_paths: Set[str])
Bases: BaseHTTPMiddleware
Restrict file uploads to certain paths.
Restrict file uploads to certain paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
FastAPI
|
The FastAPI app. |
required |
allowed_paths
|
Set[str]
|
The allowed paths. |
required |
Source code in src/zenml/zen_server/zen_server_api.py
201 202 203 204 205 206 207 208 209 |
|
dispatch(request: Request, call_next: RequestResponseEndpoint) -> Response
async
Restrict file uploads to certain paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming request. |
required |
call_next
|
RequestResponseEndpoint
|
The next function to be called. |
required |
Returns:
Type | Description |
---|---|
Response
|
The response to the request. |
Source code in src/zenml/zen_server/zen_server_api.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
Functions
catch_all(request: Request, file_path: str) -> Any
async
Dashboard endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
Request object. |
required |
file_path
|
str
|
Path to a file in the dashboard root folder. |
required |
Returns:
Type | Description |
---|---|
Any
|
The ZenML dashboard. |
Source code in src/zenml/zen_server/zen_server_api.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
|
dashboard(request: Request) -> Any
async
Dashboard endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
Request object. |
required |
Returns:
Type | Description |
---|---|
Any
|
The ZenML dashboard. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the dashboard files are not included. |
Source code in src/zenml/zen_server/zen_server_api.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
|
get_root_static_files() -> List[str]
Get the list of static files in the root dashboard directory.
These files are static files that are not in the /static subdirectory that need to be served as static files under the root URL path.
Returns:
Type | Description |
---|---|
List[str]
|
List of static files in the root directory. |
Source code in src/zenml/zen_server/zen_server_api.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
|
health() -> str
async
Get health status of the server.
Returns:
Type | Description |
---|---|
str
|
String representing the health status of the server. |
Source code in src/zenml/zen_server/zen_server_api.py
422 423 424 425 426 427 428 429 430 |
|
infer_source_context(request: Request, call_next: Any) -> Any
async
A middleware to track the source of an event.
It extracts the source context from the header of incoming requests and applies it to the ZenML source context on the API side. This way, the outgoing analytics request can append it as an additional field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
the incoming request object. |
required |
call_next
|
Any
|
a function that will receive the request as a parameter and pass it to the corresponding path operation. |
required |
Returns:
Type | Description |
---|---|
Any
|
the response to the request. |
Source code in src/zenml/zen_server/zen_server_api.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
|
initialize() -> None
Initialize the ZenML server.
Source code in src/zenml/zen_server/zen_server_api.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
|
invalid_api(invalid_api_path: str) -> None
async
Invalid API endpoint.
All API endpoints that are not defined in the API routers will be redirected to this endpoint and will return a 404 error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
invalid_api_path
|
str
|
Invalid API path. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
404 error. |
Source code in src/zenml/zen_server/zen_server_api.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
|
relative_path(rel: str) -> str
Get the absolute path of a path relative to the ZenML server module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rel
|
str
|
Relative path. |
required |
Returns:
Type | Description |
---|---|
str
|
Absolute path. |
Source code in src/zenml/zen_server/zen_server_api.py
115 116 117 118 119 120 121 122 123 124 |
|
set_secure_headers(request: Request, call_next: Any) -> Any
async
Middleware to set secure headers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming request. |
required |
call_next
|
Any
|
The next function to be called. |
required |
Returns:
Type | Description |
---|---|
Any
|
The response with secure headers set. |
Source code in src/zenml/zen_server/zen_server_api.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
track_last_user_activity(request: Request, call_next: Any) -> Any
async
A middleware to track last user activity.
This middleware checks if the incoming request is a user request and updates the last activity timestamp if it is.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming request object. |
required |
call_next
|
Any
|
A function that will receive the request as a parameter and pass it to the corresponding path operation. |
required |
Returns:
Type | Description |
---|---|
Any
|
The response to the request. |
Source code in src/zenml/zen_server/zen_server_api.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
|
validation_exception_handler(request: Any, exc: Exception) -> ORJSONResponse
Custom validation exception handler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Any
|
The request. |
required |
exc
|
Exception
|
The exception. |
required |
Returns:
Type | Description |
---|---|
ORJSONResponse
|
The error response formatted using the ZenML API conventions. |
Source code in src/zenml/zen_server/zen_server_api.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|