-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:flyteorg/flytekit into copy-all
- Loading branch information
Showing
25 changed files
with
262 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
from dataclasses import dataclass, field | ||
from typing import Dict, Optional | ||
|
||
from kubernetes.client.models import V1PodSpec | ||
from dataclasses import dataclass | ||
from typing import TYPE_CHECKING, Dict, Optional | ||
|
||
from flytekit.exceptions import user as _user_exceptions | ||
|
||
if TYPE_CHECKING: | ||
from kubernetes.client import V1PodSpec | ||
|
||
PRIMARY_CONTAINER_DEFAULT_NAME = "primary" | ||
|
||
|
||
@dataclass(init=True, repr=True, eq=True, frozen=True) | ||
@dataclass(init=True, repr=True, eq=True, frozen=False) | ||
class PodTemplate(object): | ||
"""Custom PodTemplate specification for a Task.""" | ||
|
||
pod_spec: V1PodSpec = field(default_factory=lambda: V1PodSpec(containers=[])) | ||
pod_spec: Optional["V1PodSpec"] = None | ||
primary_container_name: str = PRIMARY_CONTAINER_DEFAULT_NAME | ||
labels: Optional[Dict[str, str]] = None | ||
annotations: Optional[Dict[str, str]] = None | ||
|
||
def __post_init__(self): | ||
if self.pod_spec is None: | ||
from kubernetes.client import V1PodSpec | ||
|
||
self.pod_spec = V1PodSpec(containers=[]) | ||
if not self.primary_container_name: | ||
raise _user_exceptions.FlyteValidationException("A primary container name cannot be undefined") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.