Give a file, archive all the related tasks. This is used in the context of a cascade delete where the user deletes a file and wants to delete all the related tasks of that file. :param session: :param file: :return:
(session, file)
| 46 | |
| 47 | |
| 48 | def archive_related_tasks(session, file): |
| 49 | """ |
| 50 | Give a file, archive all the related tasks. This is used in the |
| 51 | context of a cascade delete where the user deletes a file and |
| 52 | wants to delete all the related tasks of that file. |
| 53 | :param session: |
| 54 | :param file: |
| 55 | :return: |
| 56 | """ |
| 57 | tasks = session.query(Task).filter( |
| 58 | Task.file_id == file.id |
| 59 | ).update({ |
| 60 | 'status': 'archived' |
| 61 | }) |
| 62 | return tasks |
| 63 | |
| 64 | |
| 65 | def remove_core(session: Session, working_dir: WorkingDir, existing_file: File, cascade_archive_tasks: bool = False): |