Is there any advantage to using gsutil or the google cloud storage API in production transfers?

前端 未结 2 1703
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 18:56

Which is better to use with production transfers, gsutil, or the google cloud storage API?

2条回答
  •  离开以前
    2020-12-11 19:51

    I'm not sure this is adding much over what Brandon has said. I'm very new to gcloud storage and Python, but I've quickly found that I prefer to use the gsutil command line over the python client library whereever possible. I create compute instances that copy a few GB of input data from cloud storage after they have booted. I found that its both neater and faster to do this using the gsutil command line where possible, so in my python code I use:

    import subprocess
    subprocess.call("gsutil -m cp gs://my-uberdata-archive/* /home//rawdata/", shell=True)
    

    The main reasons being that I can do the command in a single line whereas it takes several lines using the client library, and as Brandon points out, gsutil supports multi-threading with the '-m' flag. I haven't found an equivalent way to do this with the Python Client library yet.

提交回复
热议问题