DataBiosphere / dsub

Open-source command-line tool to run batch computing tasks and workflows on backend services such as Google Cloud.
Apache License 2.0
265 stars 44 forks source link

Does mounting disk images actually work? #178

Closed carbocation closed 4 years ago

carbocation commented 5 years ago

I am trying to mount a disk image (ideally, I'd mount a disk snapshot, but that's a secondary issue). However, I can't seem to get the mount to work. Error message is below. Presumably I'm passing the argument incorrectly or missing something in my incantation, but it's not obvious to me what I've done wrong. It seems that the python code being executed is invalid, but maybe this is an issue with my local python installation. Any pointers?

$ python --version
Python 2.7.16 :: Anaconda, Inc.

$ dsub --version
dsub version: 0.3.5

$ dsub --provider google-v2 --project broad-ml4cvd --image ubuntu:18.04 --command '/bin/ls ${MYDISK}' --mount MYDISK=https://www.googleapis.com/compute/v1/projects/broad-ml4cvd/global/images/dl-image-2019-05-13 1000 --logging gs://ukbb_v2/projects/jamesp/tmp/dsub --regions us-central1 --wait
Traceback (most recent call last):
  File "/Users/jamesp/anaconda2/bin/dsub", line 11, in <module>
    load_entry_point('dsub==0.3.5', 'console_scripts', 'dsub')()
  File "/Users/jamesp/anaconda2/lib/python2.7/site-packages/dsub-0.3.5-py2.7.egg/dsub/commands/dsub.py", line 998, in main
    dsub_main(prog, argv)
  File "/Users/jamesp/anaconda2/lib/python2.7/site-packages/dsub-0.3.5-py2.7.egg/dsub/commands/dsub.py", line 983, in dsub_main
    launched_job = run_main(args)
  File "/Users/jamesp/anaconda2/lib/python2.7/site-packages/dsub-0.3.5-py2.7.egg/dsub/commands/dsub.py", line 1030, in run_main
    output_file_param_util, mount_param_util)
  File "/Users/jamesp/anaconda2/lib/python2.7/site-packages/dsub-0.3.5-py2.7.egg/dsub/lib/param_util.py", line 681, in args_to_job_params
    mount_data.add(mount_param_util.make_param(name, value, disk_size=None))
  File "/Users/jamesp/anaconda2/lib/python2.7/site-packages/dsub-0.3.5-py2.7.egg/dsub/lib/param_util.py", line 273, in make_param
    if raw_uri.startswith('https://www.googleapis.com/compute'):
AttributeError: 'NoneType' object has no attribute 'startswith'
mbookman commented 5 years ago

Hi @carbocation!

Thanks for reporting the problem. There's a small mistake in the documentation, which we will fix.

The value for the --mount parameter needs to be quoted:

--mount MYDISK="https://www.googleapis.com/compute/v1/projects/broad-ml4cvd/global/images/dl-image-2019-05-13 1000"

carbocation commented 5 years ago

Thank you @mbookman

That works and permits the job to launch, but I am now getting a new error on the same topic: Error in ls--jamesp--191120-164029-12 - code 2: Execution failed: preparing disks: mounting "MYDISK" disk: invalid argument

Is this something I can fix on my end?

$ dsub --provider google-v2 --project broad-ml4cvd --image ubuntu:18.04 --command '/bin/ls ${MYDISK}' --mount MYDISK="https://www.googleapis.com/compute/v1/projects/broad-ml4cvd/global/images/dl-image-2019-05-13 1000" --logging gs://ukbb_v2/projects/jamesp/tmp/dsub --regions us-central1 --wait
Job: ls--jamesp--191120-164029-12
Provider internal-id (operation): projects/broad-ml4cvd/operations/14334704688626342724
Launched job-id: ls--jamesp--191120-164029-12
To check the status, run:
  dstat --provider google-v2 --project broad-ml4cvd --jobs 'ls--jamesp--191120-164029-12' --users 'jamesp' --status '*'
To cancel the job, run:
  ddel --provider google-v2 --project broad-ml4cvd --jobs 'ls--jamesp--191120-164029-12' --users 'jamesp'
Waiting for job to complete...
Waiting for: ls--jamesp--191120-164029-12.
  ls--jamesp--191120-164029-12: FAILURE
['Error in ls--jamesp--191120-164029-12 - code 2: Execution failed: preparing disks: mounting "MYDISK" disk: invalid argument']
JobExecutionError: One or more jobs finished with status FAILURE or CANCELED during wait.
ls--jamesp--191120-164029-12
wnojopra commented 5 years ago

Hi @carbocation

Curious - how was this disk/image created? Is this an image that you have used and has data on it, or is this something new you made for the purposes of testing?

I ask because we have been running tests regularly that confirms that this feature works. So I'm thinking that the issue has something to do with the disk/image itself.

carbocation commented 5 years ago

@wnojopra It's a real disk image that I have used before, though not recently. I'll try other disk images (we have a bunch).

wnojopra commented 5 years ago

@carbocation I've confirmed by testing just now that images from unformatted disks cause the exact same error you are seeing. After formatting the disk and re-creating the image, dsub works just fine.

If you're seeing issues with disk images you expect to be working fine, perhaps you could share some how the image was created and we can try to reproduce?

carbocation commented 5 years ago

@wnojopra Interesting. I've retried with an image that I know is formatted (which I know because it's the image used to create a machine that I launch dsub from) and I get the same error. Note the new project because this image isn't available on the other project.

dsub --provider google-v2 --project ukbb-analyses --image ubuntu:18.04 --command '/bin/ls ${MYDISK}' --mount MYDISK="https://www.googleapis.com/compute/v1/projects/ukbb-analyses/global/images/ukbb-8 1000" --logging gs://ukbb_v2/projects/jamesp/tmp/dsub --regions us-central1 --wait
Job: ls--jamesp--191120-195728-93
Provider internal-id (operation): projects/ukbb-analyses/operations/4879679752608393772
Launched job-id: ls--jamesp--191120-195728-93
To check the status, run:
  dstat --provider google-v2 --project ukbb-analyses --jobs 'ls--jamesp--191120-195728-93' --users 'jamesp' --status '*'
To cancel the job, run:
  ddel --provider google-v2 --project ukbb-analyses --jobs 'ls--jamesp--191120-195728-93' --users 'jamesp'
Waiting for job to complete...
Waiting for: ls--jamesp--191120-195728-93.
  ls--jamesp--191120-195728-93: FAILURE
['Error in ls--jamesp--191120-195728-93 - code 2: Execution failed: preparing disks: mounting "MYDISK" disk: invalid argument']
JobExecutionError: One or more jobs finished with status FAILURE or CANCELED during wait.
ls--jamesp--191120-195728-93

I tried it again with a random public disk image (CENTOS v8) but got the same error:

dsub --provider google-v2 --project ukbb-analyses --image ubuntu:18.04 --command '/bin/ls ${MYDISK}' --mount MYDISK="https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-8-v20191115 1000" --logging gs://ukbb_v2/projects/jamesp/tmp/dsub --regions us-central1 --wait
Job: ls--jamesp--191120-200326-39
Provider internal-id (operation): projects/ukbb-analyses/operations/6975660736633687107
Launched job-id: ls--jamesp--191120-200326-39
To check the status, run:
  dstat --provider google-v2 --project ukbb-analyses --jobs 'ls--jamesp--191120-200326-39' --users 'jamesp' --status '*'
To cancel the job, run:
  ddel --provider google-v2 --project ukbb-analyses --jobs 'ls--jamesp--191120-200326-39' --users 'jamesp'
Waiting for job to complete...
Waiting for: ls--jamesp--191120-200326-39.
  ls--jamesp--191120-200326-39: FAILURE
['Error in ls--jamesp--191120-200326-39 - code 2: Execution failed: preparing disks: mounting "MYDISK" disk: invalid argument']
JobExecutionError: One or more jobs finished with status FAILURE or CANCELED during wait.
ls--jamesp--191120-200326-39
wnojopra commented 5 years ago

Ah, are those boot disk images? Mounting a boot disk image won't work. You'll need to mount a data disk image.

carbocation commented 5 years ago

Oh. That's interesting, helpful, and not intuitive to me. (I say not intuitive because, for example, I can rip the boot disk out of my machine at home and plug it in elsewhere as a non-boot device and still read/write. So it's not immediately obvious that this wouldn't be the case here.)

Might be worth mentioning that limitation in the docs?

carbocation commented 5 years ago

PS - Looping back to confirm that dsub does work for me when I use --mount for a non-boot disk. Thank you for your help!

wnojopra commented 4 years ago

The docs have been updated, closing out.