fast-honey-9693
10/31/2025, 12:34 AMhost_volumes is working properly.
i've got an AWS setup, using fargate. the recent change is that i'm using a custom container. the batch job is able to launch the ec2 instance, and the task starts, but for some reason the mount isn't passed through to the container properly.
more details and things in thread.fast-honey-9693
10/31/2025, 12:35 AM"""
dead simple flow to make sure metaflow things are working like you expect
"""
from metaflow import batch, environment, FlowSpec, conda, pypi, resources, S3, step
import sys
class Flow(FlowSpec):
@batch(
gpu=1,
host_volumes="/data:/data",
image="ECR_REGISTRY:TAG",
)
@environment(vars={"NVIDIA_DRIVER_CAPABILITIES": "compute,utility"})
@step
def start(self):
print(f"step executable: {sys.executable}")
from pathlib import Path
import os
print("conda list:")
print(os.system("conda list"))
print("nvidia-smi:")
print(os.system("nvidia-smi"))
print("output of `df -h`")
print(os.system("df -h"))
import torch
print("output of `ls -alh /data")
print(os.system("ls -alh /data"))
# import boto3
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
Flow()fast-honey-9693
10/31/2025, 12:36 AMg4dn instance to /datafast-honey-9693
10/31/2025, 12:37 AMFROM --platform=linux/amd64 pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
COPY env.yaml ./
RUN conda env update -n base --file env.yaml
RUN mkdir /logs && chown 1000 /logs
RUN mkdir /metaflow && chown 1000 /metaflow
RUN mkdir /data && chown 1000 /data
ENV HOME=/metaflow
WORKDIR /metaflow
USER 1000fast-honey-9693
10/31/2025, 12:38 AMls command looks like this:
is /data available
total 0
drwxr-xr-x 2 root root 6 Oct 31 00:23 .
drwxr-xr-x 1 root root 77 Oct 31 00:26 ..
0fast-honey-9693
10/31/2025, 12:39 AMfast-honey-9693
10/31/2025, 12:41 AMnvidia-smi will report a GPU, and it's the pytorch cuda container, pytorch in the runtime will report it does not have access to CUDA.flaky-plumber-70709
10/31/2025, 1:44 AMfast-honey-9693
10/31/2025, 2:29 AMfast-honey-9693
10/31/2025, 2:30 AM# mount the NVME drive
mkdir -p /data
mkfs -t xfs /dev/nvme1n1
mount /dev/nvme1n1 /data
and here's the output (i didn't copy the last line before i lost access to the console, but the mount command completes successfully)
[ 44.277328] cloud-init[4184]: + mkdir -p /data
[ 44.278523] cloud-init[4184]: + mkfs -t xfs /dev/nvme1n1
[ 44.296694] cloud-init[4184]: meta-data=/dev/nvme1n1 isize=512 agcount=4, agsize=7629395 blks
[ 44.296880] cloud-init[4184]: = sectsz=512 attr=2, projid32bit=1
[ 44.297009] cloud-init[4184]: = crc=1 finobt=1, sparse=1, rmapbt=0
[ 44.297129] cloud-init[4184]: = reflink=1 bigtime=0 inobtcount=0
[ 44.297256] cloud-init[4184]: data = bsize=4096 blocks=30517578, imaxpct=25
[ 44.297374] cloud-init[4184]: = sunit=0 swidth=0 blks
[ 44.297494] cloud-init[4184]: naming =version 2 bsize=4096 ascii-ci=0, ftype=1
[ 44.297614] cloud-init[4184]: log =internal log bsize=4096 blocks=14901, version=2
[ 44.297733] cloud-init[4184]: = sectsz=512 sunit=0 blks, lazy-count=1
[ 44.297858] cloud-init[4184]: realtime =none extsz=4096 blocks=0, rtextents=0
[ 44.397529] cloud-init[4184]: Discarding blocks...Done.
[ 44.397771] cloud-init[4184]: + mount /dev/nvme1n1 /datafast-honey-9693
10/31/2025, 2:36 AMconda list, so nevermind on that one)flaky-plumber-70709
10/31/2025, 11:48 AMflaky-plumber-70709
10/31/2025, 11:52 AMfast-honey-9693
10/31/2025, 3:56 PM{{ .LaunchTemplateName }}:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
UserData: '{{ .MountNVMELaunchTemplateUserData }}'
and by console i mean the actual console output you get from racing to connect to the ec2 instance as soon as it's launchedfast-honey-9693
10/31/2025, 5:17 PMfast-honey-9693
10/31/2025, 6:05 PMfast-honey-9693
11/04/2025, 12:15 AM# mount the NVME drive
mkdir -p /data
mkfs -t xfs /dev/nvme1n1
mount /dev/nvme1n1 /data
chown 1000 /data
but i think that means there's some special sauce happening somewhere on the metaflow side of things that i couldn't find
because this worked just fine using their default container.
took a quick look through the codebase and didn't find anything, but am pretty curious what they're doing.flaky-plumber-70709
11/04/2025, 1:12 AMflaky-plumber-70709
11/04/2025, 1:15 AMflaky-plumber-70709
11/04/2025, 1:16 AM