Tekton
zenml.integrations.tekton
Initialization of the Tekton integration for ZenML.
The Tekton integration sub-module powers an alternative to the local orchestrator. You can enable it by registering the Tekton orchestrator with the CLI tool.
Attributes
TEKTON = 'tekton'
module-attribute
TEKTON_ORCHESTRATOR_FLAVOR = 'tekton'
module-attribute
Classes
Flavor
Class for ZenML Flavors.
Attributes
config_class: Type[StackComponentConfig]
abstractmethod
property
Returns StackComponentConfig
config class.
Returns:
Type | Description |
---|---|
Type[StackComponentConfig]
|
The config class. |
config_schema: Dict[str, Any]
property
The config schema for a flavor.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The config schema. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[StackComponent]
abstractmethod
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[StackComponent]
|
The implementation class for this flavor. |
logo_url: Optional[str]
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
Optional[str]
|
The flavor logo. |
name: str
abstractmethod
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The flavor name. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
type: StackComponentType
abstractmethod
property
Functions
from_model(flavor_model: FlavorResponse) -> Flavor
classmethod
Loads a flavor from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_model
|
FlavorResponse
|
The model to load from. |
required |
Raises:
Type | Description |
---|---|
CustomFlavorImportError
|
If the custom flavor can't be imported. |
ImportError
|
If the flavor can't be imported. |
Returns:
Type | Description |
---|---|
Flavor
|
The loaded flavor. |
Source code in src/zenml/stack/flavor.py
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 |
|
generate_default_docs_url() -> str
Generate the doc urls for all inbuilt and integration flavors.
Note that this method is not going to be useful for custom flavors, which do not have any docs in the main zenml docs.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml documentation |
Source code in src/zenml/stack/flavor.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 |
|
generate_default_sdk_docs_url() -> str
Generate SDK docs url for a flavor.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml SDK docs |
Source code in src/zenml/stack/flavor.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 |
|
to_model(integration: Optional[str] = None, is_custom: bool = True) -> FlavorRequest
Converts a flavor to a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
integration
|
Optional[str]
|
The integration to use for the model. |
None
|
is_custom
|
bool
|
Whether the flavor is a custom flavor. Custom flavors are then scoped by user and workspace |
True
|
Returns:
Type | Description |
---|---|
FlavorRequest
|
The model. |
Source code in src/zenml/stack/flavor.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 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 |
|
Integration
Base class for integration in ZenML.
Functions
activate() -> None
classmethod
Abstract method to activate the integration.
Source code in src/zenml/integrations/integration.py
170 171 172 |
|
check_installation() -> bool
classmethod
Method to check whether the required packages are installed.
Returns:
Type | Description |
---|---|
bool
|
True if all required packages are installed, False otherwise. |
Source code in src/zenml/integrations/integration.py
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 |
|
flavors() -> List[Type[Flavor]]
classmethod
Abstract method to declare new stack component flavors.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
A list of new stack component flavors. |
Source code in src/zenml/integrations/integration.py
174 175 176 177 178 179 180 181 |
|
get_requirements(target_os: Optional[str] = None) -> List[str]
classmethod
Method to get the requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
135 136 137 138 139 140 141 142 143 144 145 |
|
get_uninstall_requirements(target_os: Optional[str] = None) -> List[str]
classmethod
Method to get the uninstall requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
plugin_flavors() -> List[Type[BasePluginFlavor]]
classmethod
Abstract method to declare new plugin flavors.
Returns:
Type | Description |
---|---|
List[Type[BasePluginFlavor]]
|
A list of new plugin flavors. |
Source code in src/zenml/integrations/integration.py
183 184 185 186 187 188 189 190 |
|
StackComponentType
Bases: StrEnum
All possible types a StackComponent
can have.
Attributes
plural: str
property
Returns the plural of the enum value.
Returns:
Type | Description |
---|---|
str
|
The plural of the enum value. |
TektonIntegration
Bases: Integration
Definition of Tekton Integration for ZenML.
Functions
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the Tekton integration.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
List of stack component flavors for this integration. |
Source code in src/zenml/integrations/tekton/__init__.py
37 38 39 40 41 42 43 44 45 46 |
|
Modules
flavors
Tekton integration flavors.
Classes
TektonOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, TektonOrchestratorSettings
Configuration for the Tekton orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
tekton_hostname |
Optional[str]
|
Hostname of the Tekton server. |
kubernetes_context |
Optional[str]
|
Name of a kubernetes context to run pipelines in. If the stack component is linked to a Kubernetes service connector, this field is ignored. Otherwise, it is mandatory. |
kubernetes_namespace |
str
|
Name of the kubernetes namespace in which the pods that run the pipeline steps should be running. |
Source code in src/zenml/stack/stack_component.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 |
|
is_local: bool
property
Checks if this stack component is running locally.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a local component, False otherwise. |
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a remote component, False otherwise. |
TektonOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Flavor for the Tekton orchestrator.
config_class: Type[TektonOrchestratorConfig]
property
Returns TektonOrchestratorConfig
config class.
Returns:
Type | Description |
---|---|
Type[TektonOrchestratorConfig]
|
The config class. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[TektonOrchestrator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[TektonOrchestrator]
|
Implementation class for this flavor. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the orchestrator flavor.
Returns:
Type | Description |
---|---|
str
|
Name of the orchestrator flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
Modules
tekton_orchestrator_flavor
Tekton orchestrator flavor.
TektonOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, TektonOrchestratorSettings
Configuration for the Tekton orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
tekton_hostname |
Optional[str]
|
Hostname of the Tekton server. |
kubernetes_context |
Optional[str]
|
Name of a kubernetes context to run pipelines in. If the stack component is linked to a Kubernetes service connector, this field is ignored. Otherwise, it is mandatory. |
kubernetes_namespace |
str
|
Name of the kubernetes namespace in which the pods that run the pipeline steps should be running. |
Source code in src/zenml/stack/stack_component.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 |
|
is_local: bool
property
Checks if this stack component is running locally.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a local component, False otherwise. |
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a remote component, False otherwise. |
TektonOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Flavor for the Tekton orchestrator.
config_class: Type[TektonOrchestratorConfig]
property
Returns TektonOrchestratorConfig
config class.
Returns:
Type | Description |
---|---|
Type[TektonOrchestratorConfig]
|
The config class. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[TektonOrchestrator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[TektonOrchestrator]
|
Implementation class for this flavor. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the orchestrator flavor.
Returns:
Type | Description |
---|---|
str
|
Name of the orchestrator flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
TektonOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Settings for the Tekton orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
synchronous |
bool
|
If |
timeout |
int
|
How many seconds to wait for synchronous runs. |
client_args |
Dict[str, Any]
|
Arguments to pass when initializing the KFP client. |
client_username |
Optional[str]
|
Username to generate a session cookie for the kubeflow client. Both |
client_password |
Optional[str]
|
Password to generate a session cookie for the kubeflow client. Both |
user_namespace |
Optional[str]
|
The user namespace to use when creating experiments and runs. |
Source code in src/zenml/config/secret_reference_mixin.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
orchestrators
Initialization of the Tekton ZenML orchestrator.
Classes
TektonOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], workspace: UUID, created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator responsible for running pipelines using Tekton.
Source code in src/zenml/stack/stack_component.py
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 |
|
config: TektonOrchestratorConfig
property
Returns the TektonOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
TektonOrchestratorConfig
|
The configuration. |
log_file: str
property
Path of the daemon log file.
Returns:
Type | Description |
---|---|
str
|
Path of the daemon log file. |
pipeline_directory: str
property
Path to a directory in which the Tekton pipeline files are stored.
Returns:
Type | Description |
---|---|
str
|
Path to the pipeline directory. |
root_directory: str
property
Returns path to the root directory.
Returns:
Type | Description |
---|---|
str
|
Path to the root directory. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Tekton orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Ensures a stack with only remote components and a container registry.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
get_kubernetes_contexts() -> Tuple[List[str], Optional[str]]
Get the list of configured Kubernetes contexts and the active context.
Returns:
Type | Description |
---|---|
List[str]
|
A tuple containing the list of configured Kubernetes contexts and |
Optional[str]
|
the active context. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the environment variable specifying the run id is not set. |
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str]) -> Any
Runs the pipeline on Tekton.
This function first compiles the ZenML pipeline into a Tekton yaml and then applies this configuration to run the pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment to prepare or run. |
required |
stack
|
Stack
|
The stack the pipeline will run on. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the orchestration environment. |
required |
Raises:
Type | Description |
---|---|
RuntimeError
|
If you try to run the pipelines in a notebook environment. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
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 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 |
|
Modules
tekton_orchestrator
Implementation of the Tekton orchestrator.
KubeClientKFPClient(client: k8s_client.ApiClient, *args: Any, **kwargs: Any)
Bases: Client
KFP client initialized from a Kubernetes client.
This is a workaround for the fact that the native KFP client does not support initialization from an existing Kubernetes client.
Initializes the KFP client from a Kubernetes client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
ApiClient
|
pre-configured Kubernetes client. |
required |
args
|
Any
|
standard KFP client positional arguments. |
()
|
kwargs
|
Any
|
standard KFP client keyword arguments. |
{}
|
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
73 74 75 76 77 78 79 80 81 82 83 84 |
|
TektonOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], workspace: UUID, created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator responsible for running pipelines using Tekton.
Source code in src/zenml/stack/stack_component.py
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 |
|
config: TektonOrchestratorConfig
property
Returns the TektonOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
TektonOrchestratorConfig
|
The configuration. |
log_file: str
property
Path of the daemon log file.
Returns:
Type | Description |
---|---|
str
|
Path of the daemon log file. |
pipeline_directory: str
property
Path to a directory in which the Tekton pipeline files are stored.
Returns:
Type | Description |
---|---|
str
|
Path to the pipeline directory. |
root_directory: str
property
Returns path to the root directory.
Returns:
Type | Description |
---|---|
str
|
Path to the root directory. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Tekton orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Ensures a stack with only remote components and a container registry.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
get_kubernetes_contexts() -> Tuple[List[str], Optional[str]]
Get the list of configured Kubernetes contexts and the active context.
Returns:
Type | Description |
---|---|
List[str]
|
A tuple containing the list of configured Kubernetes contexts and |
Optional[str]
|
the active context. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the environment variable specifying the run id is not set. |
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str]) -> Any
Runs the pipeline on Tekton.
This function first compiles the ZenML pipeline into a Tekton yaml and then applies this configuration to run the pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment to prepare or run. |
required |
stack
|
Stack
|
The stack the pipeline will run on. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the orchestration environment. |
required |
Raises:
Type | Description |
---|---|
RuntimeError
|
If you try to run the pipelines in a notebook environment. |
Source code in src/zenml/integrations/tekton/orchestrators/tekton_orchestrator.py
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 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 |
|