From b973113f708a3aef512d1cea73355a413bd67c1d Mon Sep 17 00:00:00 2001 From: ChristianOertlin Date: Wed, 30 Oct 2024 09:42:53 +0100 Subject: [PATCH] add(delete fc command) (#3900) # Description adding delete flow cell cli command --- cg/cli/delete/base.py | 2 ++ cg/cli/delete/illumina_sequencing_run.py | 26 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 cg/cli/delete/illumina_sequencing_run.py diff --git a/cg/cli/delete/base.py b/cg/cli/delete/base.py index 581c950e1f..456e51d8b8 100644 --- a/cg/cli/delete/base.py +++ b/cg/cli/delete/base.py @@ -6,6 +6,7 @@ from cg.cli.delete.case import delete_case from cg.cli.delete.cases import delete_cases +from cg.cli.delete.illumina_sequencing_run import delete_illumina_run from cg.cli.delete.observations import ( delete_available_observations, delete_observations, @@ -25,3 +26,4 @@ def delete(): delete.add_command(delete_cases) delete.add_command(delete_observations) delete.add_command(delete_available_observations) +delete.add_command(delete_illumina_run) diff --git a/cg/cli/delete/illumina_sequencing_run.py b/cg/cli/delete/illumina_sequencing_run.py new file mode 100644 index 0000000000..8043582a35 --- /dev/null +++ b/cg/cli/delete/illumina_sequencing_run.py @@ -0,0 +1,26 @@ +import click + +from cg.constants.cli_options import DRY_RUN +from cg.services.illumina.post_processing.housekeeper_storage import ( + delete_sequencing_data_from_housekeeper, +) + + +@click.command("illumina-run") +@click.argument( + "flow_cell_id", + type=str, +) +@click.pass_context +def delete_illumina_run(context: click.Context, flow_cell_id: str): + """ + Delete an Illumina sequencing run. + + Args: + flow_cell_id (str): Give the flow cell id of the run to delete from statusdb and housekeeper. + """ + delete_sequencing_data_from_housekeeper( + flow_cell_id=flow_cell_id, + hk_api=context.obj.housekeeper_api, + ) + context.obj.status_db.delete_illumina_flow_cell(internal_id=flow_cell_id)