pepkit / looper

A job submitter for Portable Encapsulated Projects
http://looper.databio.org
BSD 2-Clause "Simplified" License
20 stars 7 forks source link

looper destroy error #252

Closed nsheff closed 4 years ago

nsheff commented 4 years ago

Got this error running looper destroy:

## [1 of 18] sample: GSM4467115
Removing: /project/shefflab/processed//atac_ebna2/results_pipeline/GSM4467115
Traceback (most recent call last):
  File "/home/ns5bc/.local/bin/looper", line 10, in <module>
    sys.exit(main())
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 770, in main
    return Destroyer(prj)(args)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 214, in __call__
    return self(args, preview_flag=False)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 192, in __call__
    _remove_or_dry_run(sample_output_folder, args.dry_run)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 563, in _remove_or_dry_run
    rmtree(path)
  File "/apps/software/standard/core/anaconda/5.2.0-py3.6/lib/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/apps/software/standard/core/anaconda/5.2.0-py3.6/lib/python3.6/shutil.py", line 422, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/apps/software/standard/core/anaconda/5.2.0-py3.6/lib/python3.6/shutil.py", line 420, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 39] Directory not empty: 'prealignments'
stolarczyk commented 4 years ago

It looks like it's a known quirk of shutil.rmtree

https://stackoverflow.com/questions/1557351/python-delete-non-empty-dir/21966211#21966211

nsheff commented 4 years ago

turns out -- the problem was that there were still some files in there that were being accessed by a process. so, typically, this wouldn't come up... but if there's some zombie or something still touching a file then they can't be removed, and it leads to errors. so, not really looper's fault...

stolarczyk commented 4 years ago

yes, or https://github.com/ansible/ansible/issues/34335#issuecomment-362995700