patchworks 0.11.6__tar.gz → 0.11.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {patchworks-0.11.6 → patchworks-0.11.7}/PKG-INFO +1 -1
  2. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/snakemake.md +3 -1
  3. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/Snakefile +5 -0
  4. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/pixi.toml +1 -1
  5. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/rules/common.smk +4 -0
  6. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/rules/segment.smk +16 -0
  7. patchworks-0.11.7/workflow/scripts/fetch_model.py +21 -0
  8. {patchworks-0.11.6 → patchworks-0.11.7}/.github/workflows/docs.yml +0 -0
  9. {patchworks-0.11.6 → patchworks-0.11.7}/.github/workflows/lint.yml +0 -0
  10. {patchworks-0.11.6 → patchworks-0.11.7}/.github/workflows/release.yml +0 -0
  11. {patchworks-0.11.6 → patchworks-0.11.7}/.gitignore +0 -0
  12. {patchworks-0.11.6 → patchworks-0.11.7}/.markdownlint-cli2.yaml +0 -0
  13. {patchworks-0.11.6 → patchworks-0.11.7}/README.md +0 -0
  14. {patchworks-0.11.6 → patchworks-0.11.7}/cliff.toml +0 -0
  15. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/chunks.md +0 -0
  16. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/cluster.md +0 -0
  17. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/io.md +0 -0
  18. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/merge_tile_labels.md +0 -0
  19. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/plugins/cellpose.md +0 -0
  20. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/plugins/napari.md +0 -0
  21. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/plugins/ome_zarr.md +0 -0
  22. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/relabel.md +0 -0
  23. {patchworks-0.11.6 → patchworks-0.11.7}/docs/api/tile_process.md +0 -0
  24. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/cellpose_2d.md +0 -0
  25. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/cellpose_2d.py +0 -0
  26. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/cellpose_3d.md +0 -0
  27. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/cellpose_3d.py +0 -0
  28. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/custom.md +0 -0
  29. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/custom_method.py +0 -0
  30. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/standalone_merge.md +0 -0
  31. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/stardist.md +0 -0
  32. {patchworks-0.11.6 → patchworks-0.11.7}/docs/examples/stardist_2d.py +0 -0
  33. {patchworks-0.11.6 → patchworks-0.11.7}/docs/getting_started.md +0 -0
  34. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/gpu_distributed.md +0 -0
  35. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/merging.md +0 -0
  36. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/ome_zarr_napari.md +0 -0
  37. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/performance.md +0 -0
  38. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/pitfalls.md +0 -0
  39. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/skip_empty.md +0 -0
  40. {patchworks-0.11.6 → patchworks-0.11.7}/docs/guide/tiling.md +0 -0
  41. {patchworks-0.11.6 → patchworks-0.11.7}/docs/index.md +0 -0
  42. {patchworks-0.11.6 → patchworks-0.11.7}/mkdocs.yml +0 -0
  43. {patchworks-0.11.6 → patchworks-0.11.7}/pyproject.toml +0 -0
  44. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/__init__.py +0 -0
  45. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_chunks.py +0 -0
  46. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_cluster.py +0 -0
  47. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_core.py +0 -0
  48. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_distributed.py +0 -0
  49. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_io.py +0 -0
  50. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_merge.py +0 -0
  51. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/_relabel.py +0 -0
  52. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/plugins/__init__.py +0 -0
  53. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/plugins/cellpose.py +0 -0
  54. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/plugins/napari.py +0 -0
  55. {patchworks-0.11.6 → patchworks-0.11.7}/src/patchworks/plugins/ome_zarr.py +0 -0
  56. {patchworks-0.11.6 → patchworks-0.11.7}/tests/test_core.py +0 -0
  57. {patchworks-0.11.6 → patchworks-0.11.7}/tests/test_distributed.py +0 -0
  58. {patchworks-0.11.6 → patchworks-0.11.7}/tests/test_napari.py +0 -0
  59. {patchworks-0.11.6 → patchworks-0.11.7}/tests/test_ome_zarr.py +0 -0
  60. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/.snakemake/iocache/latest.pkl +0 -0
  61. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/README.md +0 -0
  62. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/config/config.yaml +0 -0
  63. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/profile/slurm/config.yaml +0 -0
  64. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/rules/convert.smk +0 -0
  65. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/rules/merge.smk +0 -0
  66. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/scripts/_pw.py +0 -0
  67. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/scripts/convert.py +0 -0
  68. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/scripts/merge.py +0 -0
  69. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/scripts/prepare_tiles.py +0 -0
  70. {patchworks-0.11.6 → patchworks-0.11.7}/workflow/scripts/segment_tile.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchworks
3
- Version: 0.11.6
3
+ Version: 0.11.7
4
4
  Summary: Tiled processing of arbitrarily large images with globally consistent labels
5
5
  Project-URL: Homepage, https://github.com/imcf/patchworks
6
6
  Project-URL: Issues, https://github.com/imcf/patchworks/issues
@@ -223,10 +223,12 @@ prologue. The simplest path is a single shared env that the compute nodes see.
223
223
  | Symptom | Fix |
224
224
  |---------|-----|
225
225
  | `snakemake: command not found` | use `python -m snakemake` |
226
- | Segment jobs pend forever | wrong `slurm_partition`/`slurm_extra` GPU flag for your cluster |
226
+ | Segment jobs pend forever | wrong `slurm_partition`/GPU request; on scicore use `gres: "gpu:1"` |
227
+ | Segment dies, `Network is unreachable` | offline GPU nodes — the `fetch_model` localrule caches the model on the submit host first; if it still fails, your submit host has no network either (pre-download manually) |
227
228
  | `cellpose is not installed` in a job | the job's env lacks `patchworks[cellpose]` |
228
229
  | Reading the input fails | install the matching reader (`patchworks[imaris]`/`[bioio]` + a `bioio-*`) |
229
230
  | Out of GPU memory | smaller `tile_shape`, or `do_3D: false` |
231
+ | A job fails with an empty SLURM log | read `logs/segment/<index>.log` (per tile) or `logs/steps.log` — the real traceback is there |
230
232
  | Very slow | confirm GPU is used (`nvidia-smi`); try 2-D or a lower `level` |
231
233
 
232
234
  ## How it works (for the curious)
@@ -19,6 +19,11 @@ include: "rules/segment.smk"
19
19
  include: "rules/merge.smk"
20
20
 
21
21
 
22
+ # Runs on the submit host (has network) — never submitted to an offline GPU node.
23
+ localrules:
24
+ fetch_model,
25
+
26
+
22
27
  rule all:
23
28
  input:
24
29
  f"{WORK}/labels.done",
@@ -7,7 +7,7 @@
7
7
  # On a cluster, put this project on a shared filesystem the compute nodes can
8
8
  # read: the SLURM jobs re-launch snakemake from this env's interpreter.
9
9
 
10
- [project]
10
+ [workspace]
11
11
  name = "patchworks-workflow"
12
12
  channels = ["conda-forge"]
13
13
  platforms = ["linux-64"]
@@ -20,6 +20,10 @@ STAGE_OK = f"{STAGE}.done"
20
20
  LOGS = f"{WORK}/logs"
21
21
  STEPLOG = f"{LOGS}/steps.log"
22
22
 
23
+ # Marker that the segmentation model is cached locally. Produced by a local
24
+ # rule (runs on the networked submit host) so offline GPU nodes never download.
25
+ MODEL_OK = f"{WORK}/model.ready"
26
+
23
27
 
24
28
  def occupied_done(wildcards):
25
29
  """Per-tile markers for the occupied tiles (resolved after the checkpoint)."""
@@ -1,5 +1,20 @@
1
1
  # Plan tiles (checkpoint) and segment each tile on a GPU.
2
2
 
3
+
4
+ rule fetch_model:
5
+ """Cache the segmentation model on the (networked) submit host.
6
+
7
+ Declared local (see ``localrules`` in the Snakefile) so it never runs on an
8
+ offline GPU node — Cellpose downloads its weights here, into shared $HOME.
9
+ """
10
+ output:
11
+ touch(MODEL_OK),
12
+ log:
13
+ f"{LOGS}/fetch_model.log",
14
+ script:
15
+ "../scripts/fetch_model.py"
16
+
17
+
3
18
  checkpoint prepare:
4
19
  input:
5
20
  IMAGE_OK,
@@ -18,6 +33,7 @@ rule segment:
18
33
  tiles=TILES,
19
34
  stage=STAGE_OK,
20
35
  image=IMAGE_OK,
36
+ model=MODEL_OK,
21
37
  output:
22
38
  f"{WORK}/seg/{{index}}.done",
23
39
  log:
@@ -0,0 +1,21 @@
1
+ """Snakemake (local) script: cache the segmentation model before segmenting.
2
+
3
+ Runs on the submit host, which has network access, so the offline GPU nodes
4
+ never try to download Cellpose weights at run time (they read the shared
5
+ ``$HOME/.cellpose`` cache instead).
6
+ """
7
+
8
+ from _pw import start_log
9
+
10
+ start_log(snakemake.log[0]) # noqa: F821
11
+ cfg = snakemake.config # noqa: F821
12
+
13
+ if cfg.get("method", "cellpose") == "cellpose":
14
+ # _get_model downloads + caches the weights keyed by (model, gpu).
15
+ from patchworks.plugins.cellpose import _get_model
16
+
17
+ model = cfg["cellpose"]["model"]
18
+ _get_model({"model": model, "gpu": False})
19
+ print(f"[patchworks] cached segmentation model: {model}")
20
+ else:
21
+ print(f"[patchworks] method={cfg.get('method')!r}; no model to prefetch")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes