Skip to content

Commit

Permalink
first attempt at #469
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Mar 13, 2024
1 parent c089082 commit 08824da
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions looper/looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,35 +242,37 @@ def __call__(self, args, preview_flag=True):
:param bool preview_flag: whether to halt before actually removing files
"""

_LOGGER.info("Removing results:")

for sample in select_samples(prj=self.prj, args=args):
_LOGGER.info(self.counter.show(sample.sample_name))
sample_output_folder = sample_folder(self.prj, sample)
if preview_flag:
# Preview: Don't actually delete, just show files.
_LOGGER.info(str(sample_output_folder))
else:
_remove_or_dry_run(sample_output_folder, args.dry_run)

_LOGGER.info("Removing summary:")
use_pipestat = (
self.prj.pipestat_configured_project
if getattr(
args, "project", None
) # TODO this argument hasn't been added to the pydantic models.
if getattr(args, "project", None)
else self.prj.pipestat_configured
)

if use_pipestat:
_LOGGER.info("Removing summary:")
destroy_summary(
self.prj,
getattr(args, "dry_run", None),
getattr(args, "project", None),
)
else:
_LOGGER.warning(
"Pipestat must be configured to destroy any created summaries."
)

_LOGGER.info("Removing results:")

for sample in select_samples(prj=self.prj, args=args):
_LOGGER.info(self.counter.show(sample.sample_name))
sample_output_folder = sample_folder(self.prj, sample)
if preview_flag:
# Preview: Don't actually delete, just show files.
_LOGGER.info(str(sample_output_folder))
else:
if use_pipestat:
psms = self.prj.get_pipestat_managers(
sample_name=sample.sample_name
)
for pipeline_name, psm in psms.items():
psm.remove(record_identifier=sample.sample_name)
else:
_remove_or_dry_run(sample_output_folder, args.dry_run)

if not preview_flag:
_LOGGER.info("Destroy complete.")
Expand Down

0 comments on commit 08824da

Please sign in to comment.