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

DRAFT: local_storage support & efs_test label for perf testing #232

Open
wants to merge 3 commits into
base: feature/kfp
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions metaflow/metaflow_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def get_package_commands(
"after 6 tries. Exiting...' && exit 1; "
"fi" % code_package_url,
"TAR_OPTIONS='--warning=no-timestamp' tar xf job.tar",
f"mflog {code_package_url=}",
"mflog 'Task is starting.'",
]
return cmds
Expand Down
38 changes: 33 additions & 5 deletions metaflow/plugins/kfp/kfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
V1EnvVar,
V1EnvVarSource,
V1EmptyDirVolumeSource,
V1NFSVolumeSource,
V1NodeAffinity,
V1NodeSelector,
V1NodeSelectorRequirement,
Expand Down Expand Up @@ -297,11 +298,11 @@ def to_k8s_resource_format(resource: str, value: Union[int, float, str]) -> str:
resource_requirements = {}
for deco in node.decorators:
if isinstance(deco, ResourcesDecorator):
if deco.attributes.get("local_storage") is not None:
raise ValueError( # Not using DeprecationWarning to hard block the run before triggering.
"`local_storage` option is deprecated over cluster stability concerns. "
"Please use `volume` for storage request."
)
# if deco.attributes.get("local_storage") is not None:
# raise ValueError( # Not using DeprecationWarning to hard block the run before triggering.
# "`local_storage` option is deprecated over cluster stability concerns. "
# "Please use `volume` for storage request."
# )

for attr_key, attr_value in deco.attributes.items():
if attr_value is not None:
Expand Down Expand Up @@ -538,6 +539,14 @@ def _set_container_resources(
resource_requirements["gpu"],
vendor=gpu_vendor if gpu_vendor else "nvidia",
)
if "local_storage" in resource_requirements:
# TODO(talebz): remove, as this is for RMX EFS persisted GPU training
container_op.container.set_ephemeral_storage_request(
resource_requirements["local_storage"]
)
container_op.container.set_ephemeral_storage_limit(
resource_requirements["local_storage"]
)

if "shared_memory" in resource_requirements:
memory_volume = PipelineVolume(
Expand All @@ -554,6 +563,22 @@ def _set_container_resources(
)
container_op.add_pvolumes({"dev/shm": memory_volume})

if "nfs_server" in resource_requirements:
nfs_volume = PipelineVolume(
volume=V1Volume(
# k8s volume name must consist of lower case alphanumeric characters or '-',
# and must start and end with an alphanumeric character,
# but step name is python function name that tends to be alphanumeric chars with '_'
name=f"{kfp_component.step_name.lower().replace('_', '-')}-nfs",
nfs=V1NFSVolumeSource(
read_only=True,
path=resource_requirements["nfs_path"],
server=resource_requirements["nfs_server"],
),
)
)
container_op.add_pvolumes({"/mnt/nfs": nfs_volume})

affinity_match_expressions: List[V1NodeSelectorRequirement] = []

if kfp_component.accelerator_decorator:
Expand Down Expand Up @@ -714,6 +739,9 @@ def _set_container_labels(self, container_op: ContainerOp, metaflow_run_id: str)
)
container_op.add_pod_annotation(annotation_name, annotation_value)

# TODO(talebz): remove, as this is for RMX EFS persisted GPU training
container_op.add_pod_label("aip.zillowgroup.net/performance", "efs_test")

# tags.ledger.zgtools.net/* pod labels required for the ZGCP Costs Ledger
container_op.add_pod_label("tags.ledger.zgtools.net/ai-flow-name", self.name)
container_op.add_pod_label(
Expand Down
2 changes: 2 additions & 0 deletions metaflow/plugins/resources_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ def myStep(self):
"volume_type": None,
# Deprecated - kept only to show a meaningful error message
"local_storage": None,
"nfs_path": None,
"nfs_server": None,
}