cortex-lab / PinkRigs

Shared code for processing data on the pink rigs
3 stars 1 forks source link

pykilosort permission error #27

Closed takacsflora closed 1 year ago

takacsflora commented 1 year ago
251 files are waiting to be sorted ...
Traceback (most recent call last):
  File "C:\Users\Experiment\Documents\Github\PinkRigs\Analysis\+kilo\python_\run_pyKS.py", line 182, in <module>
    run_pyKS_on_queue(run_for=sys.argv[1])
  File "C:\Users\Experiment\Documents\Github\PinkRigs\Analysis\+kilo\python_\run_pyKS.py", line 151, in run_pyKS_on_queue
    shutil.rmtree(KS_workpath)
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 757, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 622, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 622, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 622, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 627, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\Experiment\.conda\envs\pyks2\lib\shutil.py", line 625, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Experiment\\Documents\\KSworkfolder\\AV008_2022-03-12_SparseNoiseNaturalImages_g0_imec1\\.kilosort\\AV008_2022-03-12_SparseNoiseNaturalImages_g0_t0.imec1.ap.cbin\\proc.dat'
takacsflora commented 1 year ago

I am unable to consistently reproduce this during single runs. And contrary to my pervious beliefs this error is probably not related to the tandem processing, as its specifically a permission error on the file that is currently being sorted. Probably a pykilosort issue...

takacsflora commented 1 year ago

okay, I think this is related to me leaving on manual ks/Ctrl-C-ing into it.

takacsflora commented 1 year ago

Well, but for example the 22.30 run is still running now 14.20pm So the run_for=5 hrs is not working.

cbimbo commented 1 year ago

Could that be due to the matlab/python sessions that were open on Kilo1 and doing some stuff while you couldn't see it?

takacsflora commented 1 year ago

I was not taking into account the day when calculating how long the ks has already been running for.