From df0bbc29e1a13d765c49d92d4fe116b66171783a Mon Sep 17 00:00:00 2001 From: Blaise Li <blaise.li__git@nsup.org> Date: Wed, 11 Apr 2018 13:50:08 +0200 Subject: [PATCH] Upload data even when pipeline fails. --- CLIP/iCLIP.snakefile | 7 +++++-- PRO-seq/PRO-seq.snakefile | 3 +++ small_RNA-seq/small_RNA-seq.snakefile | 17 ++++------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CLIP/iCLIP.snakefile b/CLIP/iCLIP.snakefile index 9e9dfec..dcde8f8 100644 --- a/CLIP/iCLIP.snakefile +++ b/CLIP/iCLIP.snakefile @@ -623,9 +623,12 @@ bam2bigwig.sh: bedGraphToBigWig failed onsuccess: - print("iCLIP data pre-processing finished.") + print("iCLIP data analysis finished.") cleanup_and_backup(output_dir, config) onerror: - print("iCLIP data pre-processing failed.") + shell(f"rm -rf {output_dir}_err") + shell(f"cp -rp {output_dir} {output_dir}_err") + cleanup_and_backup(output_dir + "_err", config) + print("iCLIP data analysis failed.") diff --git a/PRO-seq/PRO-seq.snakefile b/PRO-seq/PRO-seq.snakefile index b2b24fe..12b1075 100644 --- a/PRO-seq/PRO-seq.snakefile +++ b/PRO-seq/PRO-seq.snakefile @@ -1537,5 +1537,8 @@ onsuccess: cleanup_and_backup(output_dir, config) onerror: + shell(f"rm -rf {output_dir}_err") + shell(f"cp -rp {output_dir} {output_dir}_err") + cleanup_and_backup(output_dir + "_err", config) print("PRO-seq analysis failed.") diff --git a/small_RNA-seq/small_RNA-seq.snakefile b/small_RNA-seq/small_RNA-seq.snakefile index 43b6dd7..81041c2 100644 --- a/small_RNA-seq/small_RNA-seq.snakefile +++ b/small_RNA-seq/small_RNA-seq.snakefile @@ -3865,20 +3865,11 @@ def try_to_cluster_genes(counts_data): onsuccess: print("small RNA-seq analysis finished.") cleanup_and_backup(output_dir, config) - # print("removing metadata") - # # https://stackoverflow.com/a/45614282/1878788 - # rmtree(".snakemake/metadata") - # if config.get("backup", {}): - # user = config["backup"]["user"] - # if user == "USER": - # user = os.environ[user] - # host = config["backup"]["host"] - # # If no dest_dir, we assume the directory structure - # # is the same on the destination host - # dest_dir = config["backup"].get("dest_dir", os.getcwd()) - # print(f"backuping results to {user}@{host}:{dest_dir}") - # shell(f"rsync -vaP {output_dir} {user}@{host}:{dest_dir}") + onerror: + shell(f"rm -rf {output_dir}_err") + shell(f"cp -rp {output_dir} {output_dir}_err") + cleanup_and_backup(output_dir + "_err", config) print("small RNA-seq analysis failed.") -- GitLab