Skip to content

Commit

Permalink
Merge branch 'develop' into feature/latest-run-user
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi committed Dec 13, 2024
2 parents f70cf7e + 87cf23d commit a5abed0
Show file tree
Hide file tree
Showing 31 changed files with 714 additions and 503 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def my_pipeline(step_count: int) -> None:
data = load_data_step()
after = []
for i in range(step_count):
train_step(data, learning_rate=i * 0.0001, name=f"train_step_{i}")
train_step(data, learning_rate=i * 0.0001, id=f"train_step_{i}")
after.append(f"train_step_{i}")
model = select_model_step(..., after=after)
```
Expand Down
13 changes: 8 additions & 5 deletions src/zenml/artifacts/artifact_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ def _remove_old_attributes(cls, data: Dict[str, Any]) -> Dict[str, Any]:
)
elif is_model_artifact:
logger.warning(
"`ArtifactConfig.is_model_artifact` is deprecated and will be "
"removed soon. Use `ArtifactConfig.artifact_type` instead."
"`ArtifactConfig(..., is_model_artifact=True)` is deprecated "
"and will be removed soon. Use `ArtifactConfig(..., "
"artifact_type=ArtifactType.MODEL)` instead. For more info: "
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
)
data.setdefault("artifact_type", ArtifactType.MODEL)
elif is_deployment_artifact:
logger.warning(
"`ArtifactConfig.is_deployment_artifact` is deprecated and "
"will be removed soon. Use `ArtifactConfig.artifact_type` "
"instead."
"`ArtifactConfig(..., is_deployment_artifact=True)` is "
"deprecated and will be removed soon. Use `ArtifactConfig(..., "
"artifact_type=ArtifactType.SERVICE)` instead. For more info: "
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
)
data.setdefault("artifact_type", ArtifactType.SERVICE)

Expand Down
4 changes: 3 additions & 1 deletion src/zenml/artifacts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ def log_artifact_metadata(
"""
logger.warning(
"The `log_artifact_metadata` function is deprecated and will soon be "
"removed. Please use `log_metadata` instead."
"removed. Instead, you can consider using: "
"`log_metadata(metadata={...}, infer_artifact=True, ...)` instead. For more "
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-an-artifact"
)

from zenml import log_metadata
Expand Down
56 changes: 54 additions & 2 deletions src/zenml/client.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from zenml.step_operators import BaseStepOperator

if TYPE_CHECKING:
from zenml.config.base_settings import BaseSettings
from zenml.config.step_run_info import StepRunInfo
from zenml.models import PipelineDeploymentBase

Expand Down
4 changes: 3 additions & 1 deletion src/zenml/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def log_model_metadata(
"""
logger.warning(
"The `log_model_metadata` function is deprecated and will soon be "
"removed. Please use `log_metadata` instead."
"removed. Instead, you can consider using: "
"`log_metadata(metadata={...}, infer_model=True)` instead. For more "
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-a-model"
)

from zenml import log_metadata
Expand Down
20 changes: 12 additions & 8 deletions src/zenml/models/v2/base/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ class BaseFilter(BaseModel):
le=PAGE_SIZE_MAXIMUM,
description="Page size",
)

id: Optional[Union[UUID, str]] = Field(
default=None,
description="Id for this resource",
Expand Down Expand Up @@ -491,13 +490,13 @@ def validate_sort_by(cls, value: Any) -> Any:
)
value = column

if column in cls.FILTER_EXCLUDE_FIELDS:
if column in cls.CUSTOM_SORTING_OPTIONS:
return value
elif column in cls.FILTER_EXCLUDE_FIELDS:
raise ValueError(
f"This resource can not be sorted by this field: '{value}'"
)
elif column in cls.model_fields:
return value
elif column in cls.CUSTOM_SORTING_OPTIONS:
if column in cls.model_fields:
return value
else:
raise ValueError(
Expand Down Expand Up @@ -759,7 +758,7 @@ def offset(self) -> int:
return self.size * (self.page - 1)

def generate_filter(
self, table: Type[SQLModel]
self, table: Type["AnySchema"]
) -> Union["ColumnElement[bool]"]:
"""Generate the filter for the query.
Expand All @@ -779,7 +778,7 @@ def generate_filter(
filters.append(
column_filter.generate_query_conditions(table=table)
)
for custom_filter in self.get_custom_filters():
for custom_filter in self.get_custom_filters(table):
filters.append(custom_filter)
if self.logical_operator == LogicalOperators.OR:
return or_(False, *filters)
Expand All @@ -788,12 +787,17 @@ def generate_filter(
else:
raise RuntimeError("No valid logical operator was supplied.")

def get_custom_filters(self) -> List["ColumnElement[bool]"]:
def get_custom_filters(
self, table: Type["AnySchema"]
) -> List["ColumnElement[bool]"]:
"""Get custom filters.
This can be overridden by subclasses to define custom filters that are
not based on the columns of the underlying table.
Args:
table: The query table.
Returns:
A list of custom filters.
"""
Expand Down
Loading

0 comments on commit a5abed0

Please sign in to comment.