# patchworks Snakemake workflow.
#
#   convert ──▶ prepare (checkpoint) ──▶ segment {tile}  ──▶ merge
#                                        one GPU job per tile
#
# Run locally:
#   snakemake --cores 8 --configfile config/config.yaml
# Run on SLURM (one GPU job per tile, many GPUs in parallel):
#   snakemake --workflow-profile profile/slurm --configfile config/config.yaml

import json
from pathlib import Path

configfile: "config/config.yaml"

include: "rules/common.smk"
include: "rules/convert.smk"
include: "rules/segment.smk"
include: "rules/merge.smk"


# Runs on the submit host (has network) — never submitted to an offline GPU node.
localrules:
    fetch_model,


rule all:
    input:
        f"{WORK}/labels.done",
