Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition limit #2301

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions flytekit/core/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from flytekit.loggers import logger

TIME_PARTITION_KWARG = "time_partition"
MAX_PARTITIONS = 10


class InputsBase(object):
Expand Down Expand Up @@ -337,6 +338,9 @@ def __init__(
self._partitions = Partitions(p)
self._partitions.set_reference_artifact(self)

if self.partition_keys and len(self.partition_keys) > MAX_PARTITIONS:
raise ValueError("There is a hard limit of 10 partition keys per artifact currently.")

def __call__(self, *args, **kwargs) -> ArtifactIDSpecification:
"""
This __call__ should only ever happen in the context of a task or workflow's output, to be
Expand Down
6 changes: 6 additions & 0 deletions tests/flytekit/unit/core/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,9 @@ def test_tp_math():
assert tp2.other == datetime.timedelta(days=1)
assert tp2.granularity == Granularity.HOUR
assert tp2 is not tp


def test_lims():
# test an artifact with 11 partition keys
with pytest.raises(ValueError):
Artifact(name="test artifact", time_partitioned=True, partition_keys=[f"key_{i}" for i in range(11)])
Loading