diff --git a/crc/services/workflow_processor.py b/crc/services/workflow_processor.py index 9016b807..f0a6fa72 100644 --- a/crc/services/workflow_processor.py +++ b/crc/services/workflow_processor.py @@ -174,7 +174,7 @@ class WorkflowProcessor(object): self.is_latest_spec = False @staticmethod - def reset(workflow_model, clear_data=False): + def reset(workflow_model, clear_data=False, delete_files=False): print('WorkflowProcessor: reset: ') # Try to execute a cancel notify @@ -194,6 +194,10 @@ class WorkflowProcessor(object): for task_event in task_events: task_event.form_data = {} session.add(task_event) + if delete_files: + files = FileModel.query.filter(FileModel.workflow_id == workflow_model.id).all() + for file in files: + FileService.delete_file(file.id) session.commit() return WorkflowProcessor(workflow_model)