Skip to content

Commit e902eaf

Browse files
committed
Linting
1 parent 71ae283 commit e902eaf

File tree

9 files changed

+89
-6
lines changed

9 files changed

+89
-6
lines changed

src/zenml/execution/pipeline/dynamic/outputs.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,18 @@ def load(self) -> Any:
160160
raise ValueError(f"Invalid step run output: {result}")
161161

162162
def __getitem__(self, key: Union[str, int]) -> ArtifactFuture:
163+
"""Get an artifact future by key or index.
164+
165+
Args:
166+
key: The key or index of the artifact future.
167+
168+
Raises:
169+
ValueError: If the key or index is of an invalid type.
170+
IndexError: If the index is out of range.
171+
172+
Returns:
173+
The artifact future.
174+
"""
163175
if isinstance(key, str):
164176
index = self._output_keys.index(key)
165177
elif isinstance(key, int):
@@ -177,6 +189,14 @@ def __getitem__(self, key: Union[str, int]) -> ArtifactFuture:
177189
)
178190

179191
def __iter__(self) -> Any:
192+
"""Iterate over the artifact futures.
193+
194+
Raises:
195+
ValueError: If the step does not return any outputs.
196+
197+
Yields:
198+
The artifact futures.
199+
"""
180200
if not self._output_keys:
181201
raise ValueError(
182202
f"Step {self._invocation_id} does not return any outputs."
@@ -190,6 +210,11 @@ def __iter__(self) -> Any:
190210
)
191211

192212
def __len__(self) -> int:
213+
"""Get the number of artifact futures.
214+
215+
Returns:
216+
The number of artifact futures.
217+
"""
193218
return len(self._output_keys)
194219

195220

src/zenml/execution/pipeline/dynamic/run_context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"""Dynamic pipeline run context."""
1515

1616
import contextvars
17-
from typing import TYPE_CHECKING, Self
17+
from typing import TYPE_CHECKING
18+
19+
from typing_extensions import Self
1820

1921
from zenml.utils import context_utils
2022

src/zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def _submit_orchestrator_job(
685685
args: List[str],
686686
environment: Dict[str, str],
687687
placeholder_run: Optional["PipelineRunResponse"] = None,
688-
) -> None:
688+
) -> Optional[SubmissionResult]:
689689
"""Submits an orchestrator job to Kubernetes.
690690
691691
Args:
@@ -830,7 +830,7 @@ def launch_dynamic_step(
830830
)
831831

832832
logger.info(
833-
f"Launching job for step `%s`.",
833+
"Launching job for step `%s`.",
834834
step_run_info.pipeline_step_name,
835835
)
836836

src/zenml/logging/step_logging.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,20 @@ def setup_pipeline_logging(
940940
run_id: Optional[UUID] = None,
941941
logs_response: Optional[LogsResponse] = None,
942942
) -> Generator[Optional[LogsRequest], None, None]:
943+
"""Set up logging for a pipeline run.
944+
945+
Args:
946+
source: The log source.
947+
snapshot: The snapshot of the pipeline run.
948+
run_id: The ID of the pipeline run.
949+
logs_response: The logs response to continue from.
950+
951+
Raises:
952+
Exception: If updating the run with the logs request fails.
953+
954+
Yields:
955+
The logs request.
956+
"""
943957
logging_enabled = True
944958

945959
if handle_bool_env_var(ENV_ZENML_DISABLE_PIPELINE_LOGS_STORAGE, False):

src/zenml/pipelines/compilation_context.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
# Copyright (c) ZenML GmbH 2025. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at:
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
# or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
"""Pipeline compilation context."""
15+
116
import contextvars
2-
from typing import TYPE_CHECKING, Self
17+
from typing import TYPE_CHECKING
18+
19+
from typing_extensions import Self
320

421
from zenml.utils import context_utils
522

src/zenml/step_operators/step_operator_entrypoint_configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class StepOperatorEntrypointConfiguration(StepEntrypointConfiguration):
3636
"""Base class for step operator entrypoint configurations."""
3737

3838
def __init__(self, *args: Any, **kwargs: Any) -> None:
39+
"""Initialize the step operator entrypoint configuration.
40+
41+
Args:
42+
*args: The arguments to pass to the superclass.
43+
**kwargs: The keyword arguments to pass to the superclass.
44+
"""
3945
super().__init__(*args, **kwargs)
4046
self._step_run: Optional["StepRunResponse"] = None
4147

src/zenml/steps/base_step.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,22 @@ def submit(
633633
after: Union["StepRunFuture", Sequence["StepRunFuture"], None] = None,
634634
**kwargs: Any,
635635
) -> "StepRunOutputsFuture":
636+
"""Submit the step to run concurrently in a separate thread.
637+
638+
Args:
639+
*args: The arguments to pass to the step function.
640+
id: The invocation ID of the step.
641+
after: The step run output futures to wait for before executing the
642+
step.
643+
**kwargs: The keyword arguments to pass to the step function.
644+
645+
Raises:
646+
RuntimeError: If this method is called outside of a dynamic
647+
pipeline.
648+
649+
Returns:
650+
The step run output future.
651+
"""
636652
from zenml.execution.pipeline.dynamic.run_context import (
637653
DynamicPipelineRunContext,
638654
)

src/zenml/steps/step_context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
List,
2222
Mapping,
2323
Optional,
24-
Self,
2524
Sequence,
2625
Type,
2726
)
2827

28+
from typing_extensions import Self
29+
2930
from zenml.exceptions import StepContextError
3031
from zenml.logger import get_logger
3132
from zenml.utils import context_utils

src/zenml/utils/context_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import contextvars
1717
import threading
1818
from contextvars import ContextVar
19-
from typing import Any, ClassVar, Generic, List, Optional, Self, TypeVar
19+
from typing import Any, ClassVar, Generic, List, Optional, TypeVar
20+
21+
from typing_extensions import Self
2022

2123
T = TypeVar("T")
2224

0 commit comments

Comments
 (0)