bids-apps / freesurfer

BIDS app wrapping recon-all from FreeSurfer
Apache License 2.0
41 stars 35 forks source link

rmtree removal #7

Closed alexlicohen closed 7 years ago

alexlicohen commented 7 years ago

Currently, this does not allow for sequentially running autorecon1 then 2, etc... because of the deletion of the output directory if it exists:

if os.path.exists(os.path.join(output_dir, fsid)): rmtree(os.path.join(output_dir, fsid)) run(cmd)

The default should be to use the existing output directory per standard freesurfer convention. You could add an optional flag/option of --clean to switch the rmtree lines back on...

chrisgorgo commented 7 years ago

The tree removal is there to allow for restarting interrupted FreeSurfer runs. I wonder if there could be a smart way to distinguish between interrupted run and run that was instructed to go only through a subset of stages.

alexlicohen commented 7 years ago

To restart interrupted FreeSurfer runs, you just have to delete a file in the scripts directory called "IsRunning".

There's also the situation of another freesurfer process activitely processing in that output... if we don't need to account for that then this would work: If dir is present AND IsRunning is present -> rmtree then run cmd If dir is present AND IsRunning is absent -> run cmd (freesurfer knows what to do)

otherwise, you could consider the following: If dir is present AND IsRunning is present AND --force_overwrite is not set -> error/exit (b/c it might be ok, just in use) If dir is present AND IsRunning is present AND --force_overwrite is set -> rmtree then run cmd (b/c you know it's been interrupted) If dir is present AND IsRunning is absent AND --force_overwrite is not set -> run cmd (freesurfer knows what to do for sequential processing) If dir is present AND IsRunning is absent AND --force_overwrite is set -> rmtree then run cmd (b/c you know it's been interrupted)

there is also "recon-all -make all -s " which will attempt to resume the interrupted process, but that may be too much...

https://surfer.nmr.mgh.harvard.edu/fswiki/UserContributions/FAQ#Q.Ihada.5BPowerOutage.7CComputerFailure.7CSpilledcoffeeoncomputer.7Cetc.5D.2ChowcanIresumetherecon-all.3F

-Alex


Alexander Li Cohen, M.D., Ph.D. E-mail: Alexander.Cohen2@childrens.harvard.edu (Medical/Science Email) E-mail: alexcohen@gmail.com (Lifetime Email)

On Fri, Dec 23, 2016 at 9:27 AM, Chris Filo Gorgolewski < notifications@github.com> wrote:

The tree removal is there to allow for restarting interrupted FreeSurfer runs. I wonder if there could be a smart way to distinguish between interrupted run and run that was instructed to go only through a subset of stages.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BIDS-Apps/freesurfer/issues/7#issuecomment-268997600, or mute the thread https://github.com/notifications/unsubscribe-auth/AIPa__NhH2EQ2lZ_acj4mMgNS7mvCRnDks5rK9pVgaJpZM4LUfzY .

chrisgorgo commented 7 years ago

I don't think we need to account for the situation where another process is running. Looking for the IsRunning file is a much better solution than what we have now.

On Fri, Dec 23, 2016 at 11:17 AM, Alexander Li Cohen < notifications@github.com> wrote:

To restart interrupted FreeSurfer runs, you just have to delete a file in the scripts directory called "IsRunning".

There's also the situation of another freesurfer process activitely processing in that output... if we don't need to account for that then this would work: If dir is present AND IsRunning is present -> rmtree then run cmd If dir is present AND IsRunning is absent -> run cmd (freesurfer knows what to do)

otherwise, you could consider the following: If dir is present AND IsRunning is present AND --force_overwrite is not set -> error/exit (b/c it might be ok, just in use) If dir is present AND IsRunning is present AND --force_overwrite is set -> rmtree then run cmd (b/c you know it's been interrupted) If dir is present AND IsRunning is absent AND --force_overwrite is not set -> run cmd (freesurfer knows what to do for sequential processing) If dir is present AND IsRunning is absent AND --force_overwrite is set -> rmtree then run cmd (b/c you know it's been interrupted)

there is also "recon-all -make all -s " which will attempt to resume the interrupted process, but that may be too much...

https://surfer.nmr.mgh.harvard.edu/fswiki/UserContributions/FAQ#Q.Ihada. 5BPowerOutage.7CComputerFailure.7CSpilledcoffeeoncomputer.7Cetc.5D. 2ChowcanIresumetherecon-all.3F

-Alex


Alexander Li Cohen, M.D., Ph.D. E-mail: Alexander.Cohen2@childrens.harvard.edu (Medical/Science Email) E-mail: alexcohen@gmail.com (Lifetime Email)

On Fri, Dec 23, 2016 at 9:27 AM, Chris Filo Gorgolewski < notifications@github.com> wrote:

The tree removal is there to allow for restarting interrupted FreeSurfer runs. I wonder if there could be a smart way to distinguish between interrupted run and run that was instructed to go only through a subset of stages.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/BIDS-Apps/freesurfer/issues/7#issuecomment-268997600 , or mute the thread https://github.com/notifications/unsubscribe-auth/AIPa__NhH2EQ2lZ_ acj4mMgNS7mvCRnDks5rK9pVgaJpZM4LUfzY .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BIDS-Apps/freesurfer/issues/7#issuecomment-269012661, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkp4ghvbAh4qIuOR1RJR5r8uu2fJHdks5rK_Q3gaJpZM4LUfzY .

chrisgorgo commented 7 years ago

Closed via #10