pydra icon indicating copy to clipboard operation
pydra copied to clipboard

Add CLI to pydra

Open satra opened this issue 5 years ago • 5 comments

add a CLI and an option to clean a cachedir

when pydra runs, it uses lockfiles, but these stay if the process gets cancelled behind the scenes. a subsequent rerun without clearing the cache would result in pydra waiting forever for these tasks to finish. the cli clean option should remove folder associated with the lockfile and then the lockfile themselves. obviously if two users are using the same cache, this would not work cleanly. but users can always point to each others cache as readonly locations.

the CLI can be extended to introspect cache directory, messages, pickle files, etc.,.

satra avatar Jun 20 '20 19:06 satra

here is example code:

from glob import glob
import os
import shutil

fl = glob('cache-wf/*.lock')
checksums = [val.split('_')[1][:64] for val in fl]
paths = []
for checksum in checksums:
    paths.extend(glob(f"cache-wf/*{checksum}*"))
for path in paths:
    if os.path.isdir(path):
        shutil.rmtree(path)
    else:
        os.unlink(path)

satra avatar Jun 23 '20 14:06 satra

@satra - i wanted to clarify your idea behind the cli, this is meant to be cli to clean or check the results after running the task or workflow, is that right?

djarecka avatar Jun 23 '20 14:06 djarecka

it will have different sub commands like the nipype cli.

satra avatar Jun 23 '20 14:06 satra

clean would be just one sub command.

satra avatar Jun 23 '20 14:06 satra

Ideas to include

  • Clean cache
  • Crash dump
  • Rerun?
  • Run a task?

tclose avatar Jun 18 '25 20:06 tclose