From 9280783f29fb194aa04081cc5ec46cef246ba4d5 Mon Sep 17 00:00:00 2001 From: Taleb Zeghmi Date: Thu, 12 Sep 2024 11:24:11 -0700 Subject: [PATCH 1/2] AIP-8595 remove -volume --- metaflow/plugins/aip/aip.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/metaflow/plugins/aip/aip.py b/metaflow/plugins/aip/aip.py index 04b7af03bb5..9de2ac8c635 100644 --- a/metaflow/plugins/aip/aip.py +++ b/metaflow/plugins/aip/aip.py @@ -999,9 +999,7 @@ def _create_volume( ) self._set_container_labels(resource) - volume = PipelineVolume( - name=f"{volume_name}-volume", pvc=resource.outputs["name"] - ) + volume = PipelineVolume(name=f"{volume_name}", pvc=resource.outputs["name"]) return (resource, volume) @staticmethod From 0ac13aafe8280e5d3f1388ea5289ea0cb2ca5159 Mon Sep 17 00:00:00 2001 From: Taleb Zeghmi Date: Fri, 13 Sep 2024 17:45:04 -0700 Subject: [PATCH 2/2] AIP-8595 truncate volume name --- metaflow/plugins/aip/aip.py | 4 +++- metaflow/plugins/aip/tests/flows/resources_flow.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/metaflow/plugins/aip/aip.py b/metaflow/plugins/aip/aip.py index 9de2ac8c635..0f10a91bba6 100644 --- a/metaflow/plugins/aip/aip.py +++ b/metaflow/plugins/aip/aip.py @@ -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}) diff --git a/metaflow/plugins/aip/tests/flows/resources_flow.py b/metaflow/plugins/aip/tests/flows/resources_flow.py index f8b5cbe234a..a162704461a 100644 --- a/metaflow/plugins/aip/tests/flows/resources_flow.py +++ b/metaflow/plugins/aip/tests/flows/resources_flow.py @@ -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() ) @@ -216,4 +217,4 @@ def end(self): if __name__ == "__main__": - ResourcesFlow() + ResourcesFlowLooooooooooooooooooooooongNaaaaaaaaaaaaaaaaaaaaame()