Skip to content

Commit b7ddcd3

Browse files
committed
CI fixes
1 parent 87e2a54 commit b7ddcd3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/zenml/artifacts/in_memory_cache.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# permissions and limitations under the License.
1414
"""In-memory artifact cache."""
1515

16-
from typing import Any
16+
import contextvars
17+
from typing import Any, Dict
1718
from uuid import UUID
1819

1920
from zenml.utils import context_utils
@@ -22,12 +23,12 @@
2223
class InMemoryArtifactCache(context_utils.BaseContext):
2324
"""In-memory artifact cache."""
2425

25-
__context_var__ = context_utils.ContextVar("in_memory_artifact_cache")
26+
__context_var__ = contextvars.ContextVar("in_memory_artifact_cache")
2627

2728
def __init__(self) -> None:
2829
"""Initialize the artifact cache."""
2930
super().__init__()
30-
self._cache = {}
31+
self._cache: Dict[UUID, Any] = {}
3132

3233
def clear(self) -> None:
3334
"""Clear the artifact cache."""

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,17 @@ def get_artifact(self, key: str) -> ArtifactFuture:
140140
Args:
141141
key: The key of the artifact future.
142142
143+
Raises:
144+
KeyError: If no artifact for the given name exists.
145+
143146
Returns:
144147
The artifact future.
145148
"""
146149
if key not in self._output_keys:
147-
raise KeyError(f"Invalid key: {key}")
150+
raise KeyError(
151+
f"Step run {self._invocation_id} does not have an output with "
152+
f"the name: {key}."
153+
)
148154

149155
return ArtifactFuture(
150156
wrapped=self._wrapped,

src/zenml/models/v2/core/artifact_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,11 @@ def load(self, disable_cache: bool = False) -> Any:
455455
cache = InMemoryArtifactCache.get()
456456

457457
if cache and (data := cache.get_artifact_data(self.id)):
458-
logger.debug(f"Returning artifact data (%s) from cache", self.id)
458+
logger.debug("Returning artifact data (%s) from cache", self.id)
459459
return data
460460

461461
data = load_artifact_from_response(self)
462-
if not disable_cache:
462+
if cache and not disable_cache:
463463
cache.set_artifact_data(self.id, data)
464464
return data
465465

0 commit comments

Comments
 (0)