gsutil cp错误 - 设备或资源繁忙

时间:2014-05-16 14:09:30

标签: google-cloud-storage google-compute-engine

我遇到了gsutil cp的问题。我收到“OSError:[Errno 16]设备或资源忙”错误。我正在使用python 2.7.2。 gsutil输出如下。我尝试更改我的临时目录,这没有帮助 知道可能导致此错误的原因是什么?我已经尝试了很多次,有时文件上传尽管有错误消息,但有时它没有。
谢谢!

Fri May 16 14:05:50 ~ > gsutil cp hello.txt gs://cg2
Copying file://hello.txt [Content-Type=text/plain]...
Traceback (most recent call last):
  File "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 261, in _run_finalizers
    finalizer()
  File "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 200, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 249, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 247, in rmtree
    os.remove(fullname)
OSError: [Errno 16] Device or resource busy: '/ifs/scratch/c2b2/ngs_lab/db2175/TEMP/pymp-omqdNL/.nfs00000000250c4c2000003c71'
Traceback (most recent call last):
  File "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 261, in _run_finalizers
    finalizer()
  File "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 200, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 249, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 247, in rmtree
    os.remove(fullname)
OSError: [Errno 16] Device or resource busy: '/ifs/scratch/c2b2/ngs_lab/db2175/TEMP/pymp-u61unF/.nfs00000000251f72fd00003c72'

1 个答案:

答案 0 :(得分:1)

如果查看the gsutil cp command source code,您会看到一些代码路径调用tempfile.NamedTemporaryFile。您的环境中的TEMP / TMPDIR / TMP设置似乎指向NFS目录,这有时会在删除临时目录时导致错误。如果更改环境以便在本地磁盘上创建临时文件,则应该不再遇到此问题。