Skip to content

Commit

Permalink
AIP-8595 truncate volume name
Browse files Browse the repository at this point in the history
  • Loading branch information
talebzeghmi committed Sep 14, 2024
1 parent 9280783 commit 0ac13aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion metaflow/plugins/aip/aip.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,9 @@ def _create_volume(
size: str,
volume_type: Optional[str],
) -> Tuple[ResourceOp, PipelineVolume]:
volume_name = "{{pod.name}}"
# AIP-8595(talebz): to avoid volume name "must be no more than 63 characters error"
# truncate from the beginning (the suffix has more entropy)
volume_name = "{{=sprig.trunc(-63, pod.name)}}"
attribute_outputs = {"size": "{.status.capacity.storage}"}
requested_resources = V1ResourceRequirements(requests={"storage": size})

Expand Down
5 changes: 3 additions & 2 deletions metaflow/plugins/aip/tests/flows/resources_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def __repr__(self):
return "Dataset"


class ResourcesFlow(FlowSpec):
# AIP-8595(talebz): To validate that volume names are truncated to 63 characters
class ResourcesFlowLooooooooooooooooooooooongNaaaaaaaaaaaaaaaaaaaaame(FlowSpec):
json_param: Dict = Parameter(
"json_param", default=default_dict, type=TestTypeClass()
)
Expand Down Expand Up @@ -216,4 +217,4 @@ def end(self):


if __name__ == "__main__":
ResourcesFlow()
ResourcesFlowLooooooooooooooooooooooongNaaaaaaaaaaaaaaaaaaaaame()

0 comments on commit 0ac13aa

Please sign in to comment.