Skip to content

Commit 9dbb77a

Browse files
committed
update for latest bulker, looper and divvy updates
1 parent 16de255 commit 9dbb77a

17 files changed

Lines changed: 496 additions & 359 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
site
22
venv/
33
.venv/
4+
.cache/
45

56
.DS_Store
67
/docs/looper/notebooks/hello_looper-master/
@@ -11,3 +12,4 @@ venv/
1112
/.idea/
1213
/docs/pipestat/notebooks/.ipynb_checkpoints/
1314
/docs/looper/notebooks/.ipynb_checkpoints/
15+
node_modules

docs/geofetch/code/python-usage.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,6 @@ projects['GSE95654_samples'].sample_table.iloc[:15 , :5]
184184

185185

186186

187-
<div>
188-
<style scoped>
189-
.dataframe tbody tr th:only-of-type {
190-
vertical-align: middle;
191-
}
192-
193-
.dataframe tbody tr th {
194-
vertical-align: top;
195-
}
196-
197-
.dataframe thead th {
198-
text-align: right;
199-
}
200-
</style>
201187
<table border="1" class="dataframe">
202188
<thead>
203189
<tr style="text-align: right;">
@@ -340,6 +326,5 @@ projects['GSE95654_samples'].sample_table.iloc[:15 , :5]
340326
</tr>
341327
</tbody>
342328
</table>
343-
</div>
344329

345330

docs/looper/advanced-guide/advanced-computing.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ The `{CODE}` variable is populated by the populated result of the command templa
7777
echo 'Compute node:' `hostname`
7878
echo 'Start time:' `date +'%Y-%m-%d %T'`
7979

80+
{PRE_COMMAND}
81+
8082
srun {CODE}
83+
84+
{POST_COMMAND}
8185
```
8286

8387
Now that you understand the difference between the command template and the submission template, let's move on to how you can configure looper for different computing environments.
@@ -124,12 +128,7 @@ The `submission_template` attribute is a path to a template file. The template f
124128

125129
### Creating a custom compute package
126130

127-
To create a custom compute package and add it to divvy is easy:
128-
129-
1. Create your own template, a text file with `{VARIABLE}` syntax for any job-specific variables. You can find examples in the [submit_templates](https://github.com/pepkit/divcfg/tree/master/templates) folder.
130-
2. Add a new compute package as an entry under `compute_packages` in your divvy config file.
131-
3. Point to your custom template in the `submission_template` attribute of your new compute package.
132-
4. Add the appropriate `submission_command` for this package.
131+
For step-by-step instructions, see [How to create custom submission templates](../how-to/custom-submission-templates.md). For bulker-specific setup, see [Using looper with bulker](../how-to/bulker.md).
133132

134133
### Using divvy to submit jobs from the command-line
135134

@@ -172,7 +171,11 @@ Activating compute package 'slurm'
172171
echo 'Compute node:' `hostname`
173172
echo 'Start time:' `date +'%Y-%m-%d %T'`
174173

174+
{PRE_COMMAND}
175+
175176
{CODE}
177+
178+
{POST_COMMAND}
176179
```
177180

178181
This gives us a way to view the SLURM template.
@@ -205,7 +208,11 @@ Activating compute package 'slurm'
205208
echo 'Compute node:' `hostname`
206209
echo 'Start time:' `date +'%Y-%m-%d %T'`
207210

211+
{PRE_COMMAND}
212+
208213
{CODE}
214+
215+
{POST_COMMAND}
209216
```
210217

211218
Sometimes it's more convenient to provide settings in through a file, instead of on the command line.
@@ -344,8 +351,11 @@ adapters:
344351
MEM: compute.mem
345352
DOCKER_ARGS: compute.docker_args
346353
DOCKER_IMAGE: compute.docker_image
347-
SINGULARITY_IMAGE: compute.singularity_image
348-
SINGULARITY_ARGS: compute.singularity_args
354+
APPTAINER_IMAGE: compute.apptainer_image
355+
APPTAINER_ARGS: compute.apptainer_args
356+
BULKER_CRATE: compute.bulker_crate
357+
PRE_COMMAND: compute.pre_command
358+
POST_COMMAND: compute.post_command
349359
```
350360

351361
The divvy adapters is a section in the divvy configuration file that links the divvy template variable (left side) to any other arbitrary variable names (right side).
@@ -438,14 +448,14 @@ Variables that describes settings of a **compute environment** should go in the
438448

439449
### Pipeline interface
440450

441-
Variables that are **specific to a pipeline** can be defined in the `pipeline interface` file, `compute` section.As an example of a variable pulled from the `compute` section, we defined in our `pipeline_interface.yaml` a variable pointing to the singularity or docker image that can be used to run the pipeline, like this:
451+
Variables that are **specific to a pipeline** can be defined in the `pipeline interface` file, `compute` section.As an example of a variable pulled from the `compute` section, we defined in our `pipeline_interface.yaml` a variable pointing to the apptainer or docker image that can be used to run the pipeline, like this:
442452

443453
```yaml
444454
compute:
445-
singularity_image: /absolute/path/to/images/image
455+
apptainer_image: /absolute/path/to/images/image
446456
```
447457

448-
Now, this variable will be available for use in a template as `{SINGULARITY_IMAGE}`. This makes sense to put in the pipeline interface because it is specific to this pipeline. This path should probably be absolute, because a relative path will be interpreted as relative to the working directory where your job is executed (*not* relative to the pipeline interface). This section is also useful for adjusting the amount of resources we need to request from a resource manager like SLURM. For example: `{MEM}`, `{CORES}`, and `{TIME}` are all defined frequently in this section, and they vary for different input file sizes.
458+
Now, this variable will be available for use in a template as `{APPTAINER_IMAGE}`. This makes sense to put in the pipeline interface because it is specific to this pipeline. This path should probably be absolute, because a relative path will be interpreted as relative to the working directory where your job is executed (*not* relative to the pipeline interface). This section is also useful for adjusting the amount of resources we need to request from a resource manager like SLURM. For example: `{MEM}`, `{CORES}`, and `{TIME}` are all defined frequently in this section, and they vary for different input file sizes.
449459

450460
### Project config
451461

docs/looper/advanced-guide/advanced-run-options.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ It's quite simple: if you want to run 100 samples in a single job submission scr
2828

2929
But what if your samples are quite different in terms of input file size? For example, your project may include many small samples, which you'd like to lump together with 10 jobs to 1, but you also have a few control samples that are very large and should have their own dedicated job. If you just use `--lump-n` with 10 samples per job, you could end up lumping your control samples together, which would be terrible. To alleviate this problem, `looper` provides the `--lump` argument, which uses input file size to group samples together. By default, you specify an argument in number of gigabytes. Looper will go through your samples and accumulate them until the total input file size reaches your limit, at which point it finalizes and submits the job. This will keep larger files in independent runs and smaller files grouped together.
3030

31-
<<<<<<< HEAD
32-
### Lumping samples into number of jobs: `--lumpj`
33-
=======
3431
### Lumping jobs by job count: `--lump-j`
35-
>>>>>>> master
3632

3733
If you want to split your samples across a specific number of jobs, use `--lump-j`. For example, `--lump-j 10` will distribute all your samples evenly across 10 jobs.
3834

docs/looper/developer-tutorial/writing-a-pipeline-interface.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ cat results/submission/count_lines_usa.sub
487487
echo 'Compute node:' `hostname`
488488
echo 'Start time:' `date +'%Y-%m-%d %T'`
489489

490-
pipeline/count_lines.sh data/usa.txt
490+
491+
492+
pipeline/count_lines.sh data/usa.txt
493+
491494
```
492495

493496
We recommend pipeline authors configure their pipeline interfaces with appropriate `size_dependent_variables` file, which should be distributed alongside the pipeline interface.
@@ -525,7 +528,7 @@ Looper will run this command before running each job, allowing you to create lit
525528
## Project-level pipeline interfaces
526529
527530
Remember, looper distinguishes sample-level from project-level pipelines.
528-
This is explained in detail in [Advanced run options](../advanced-guide/advanced-run-options.md) and in [How to run a project-level pipeline](../how-to/project-level-pipelines.md).
531+
This is explained in detail in [Advanced run options](../advanced-guide/advanced-run-options.md) and in [How to run a project-level pipeline](../user-tutorial/project-level-pipelines.md).
529532
Basically, sample-level pipelines run *once per sample*, whereas project-level pipelines run *once per project*.
530533
If this interface were describing a project-level pipeline, we would change out `sample_interface` to `project_interface`.
531534

docs/looper/divvy-cli.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ Available compute packages:
2626

2727
local
2828
slurm
29-
singularity
29+
sge
30+
apptainer
31+
apptainer_slurm
32+
bulker_local
33+
bulker_slurm
34+
default
3035
docker
3136
```
3237

@@ -109,7 +114,18 @@ $ divvy inspect --package slurm
109114
#SBATCH --mem='{MEM}'
110115
#SBATCH --cpus-per-task='{CORES}'
111116
#SBATCH --time='{TIME}'
112-
...
117+
#SBATCH --partition='{PARTITION}'
118+
#SBATCH -m block
119+
#SBATCH --ntasks=1
120+
121+
echo 'Compute node:' `hostname`
122+
echo 'Start time:' `date +'%Y-%m-%d %T'`
123+
124+
{PRE_COMMAND}
125+
126+
{CODE}
127+
128+
{POST_COMMAND}
113129
```
114130

115131
## Variable sources
@@ -147,6 +163,11 @@ These variables are commonly used in compute package templates:
147163
| `{CORES}` | Number of CPU cores |
148164
| `{TIME}` | Wall time limit |
149165
| `{PARTITION}` | Cluster partition/queue |
166+
| `{PRE_COMMAND}` | Commands to run before the pipeline command (e.g., module loads, TMPDIR setup) |
167+
| `{POST_COMMAND}` | Commands to run after the pipeline command (e.g., cleanup) |
168+
| `{BULKER_CRATE}` | Bulker crate identifier for the bulker_slurm and bulker_local packages |
169+
| `{APPTAINER_IMAGE}` | Apptainer container image path |
170+
| `{APPTAINER_ARGS}` | Extra arguments passed to apptainer (e.g., bind mounts) |
150171

151172
## Environment variables
152173

docs/looper/how-to/bulker.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# How to use looper with bulker
2+
3+
[Bulker](https://bulker.io) is a multi-container environment manager that provides containerized CLI tools via lightweight shim scripts. Looper ships with built-in compute packages for running bulker-activated pipelines, both locally and on SLURM clusters.
4+
5+
!!! note "What you'll accomplish"
6+
Run a bulker-activated pipeline locally or on a SLURM cluster using looper's built-in bulker compute packages.
7+
8+
!!! info "Prerequisites"
9+
- Looper is installed and working
10+
- Bulker is installed and you have a crate manifest for your pipeline
11+
12+
## 1. Specify the bulker crate in your pipeline interface
13+
14+
The pipeline author specifies which bulker crate to use in the `compute` section of the pipeline interface:
15+
16+
```yaml title="pipeline_interface.yaml"
17+
pipeline_name: my_pipeline
18+
sample_interface:
19+
command_template: >
20+
my_tool {sample.input_file}
21+
compute:
22+
bulker_crate: bulker/demo:default
23+
```
24+
25+
## 2. Run locally with bulker_local
26+
27+
To run bulker-activated pipelines on your local machine:
28+
29+
```shell
30+
looper run --package bulker_local
31+
```
32+
33+
This activates the bulker crate and runs the pipeline command inside the bulker environment. The submission command is `sh`, so jobs run sequentially in the current shell.
34+
35+
## 3. Submit to SLURM with bulker_slurm
36+
37+
To submit bulker-activated pipelines to a SLURM cluster:
38+
39+
```shell
40+
looper run --package bulker_slurm \
41+
--compute partition=standard time='04:00:00' cores='8' mem='16000'
42+
```
43+
44+
This uses the built-in `bulker_slurm` template, which handles SLURM submission headers and bulker activation automatically.
45+
46+
## 4. Use pre-commands for environment setup
47+
48+
On many HPC systems, bulker needs additional setup before it can run — for example, loading a module or setting `TMPDIR` to a shared scratch location. Use `pre_command` for this:
49+
50+
```shell
51+
looper run --package bulker_slurm \
52+
--compute partition=standard time='04:00:00' cores='8' mem='16000' \
53+
pre_command='export TMPDIR=/scratch/$USER/tmp && mkdir -p $TMPDIR && module load apptainer'
54+
```
55+
56+
Or set it in your looper config so you don't have to type it every time:
57+
58+
```yaml title=".looper.yaml"
59+
pep_config: pep_config.yaml
60+
output_dir: results
61+
pipeline_interfaces:
62+
- pipeline/pipeline_interface.yaml
63+
cli:
64+
run:
65+
package: bulker_slurm
66+
compute:
67+
partition: standard
68+
time: '04:00:00'
69+
cores: '8'
70+
mem: '16000'
71+
pre_command: >
72+
export TMPDIR=/scratch/$USER/tmp && mkdir -p $TMPDIR && module load apptainer
73+
```
74+
75+
## Available bulker packages
76+
77+
| Package | Submission | Description |
78+
|---------|-----------|-------------|
79+
| `bulker_local` | `sh` | Run bulker-activated pipelines locally |
80+
| `bulker_slurm` | `sbatch` | Submit bulker-activated pipelines to SLURM |
81+
82+
## Appendix: Built-in bulker templates
83+
84+
### bulker_local template
85+
86+
```bash title="localhost_bulker_template.sub"
87+
#!/bin/bash
88+
89+
echo 'Compute node:' `hostname`
90+
echo 'Start time:' `date +'%Y-%m-%d %T'`
91+
92+
{PRE_COMMAND}
93+
94+
eval "$(bulker activate -e {BULKER_CRATE})"
95+
96+
{
97+
{CODE}
98+
} | tee {LOGFILE} -i
99+
100+
{POST_COMMAND}
101+
```
102+
103+
### bulker_slurm template
104+
105+
```bash title="bulker_slurm_template.sub"
106+
#!/bin/bash
107+
#SBATCH --job-name='{JOBNAME}'
108+
#SBATCH --output='{LOGFILE}'
109+
#SBATCH --mem='{MEM}'
110+
#SBATCH --cpus-per-task='{CORES}'
111+
#SBATCH --time='{TIME}'
112+
#SBATCH --partition='{PARTITION}'
113+
#SBATCH -m block
114+
#SBATCH --ntasks=1
115+
116+
echo 'Compute node:' `hostname`
117+
echo 'Start time:' `date +'%Y-%m-%d %T'`
118+
119+
{PRE_COMMAND}
120+
121+
eval "$(bulker activate -e {BULKER_CRATE})"
122+
123+
{CODE}
124+
125+
{POST_COMMAND}
126+
```
127+
128+
## See also
129+
130+
- [Configuring cluster computing](../user-tutorial/compute-settings.md) -- tutorial on compute settings
131+
- [Custom submission templates](custom-submission-templates.md) -- create your own compute packages
132+
- [Running jobs in containers](containers.md) -- Docker and Apptainer packages

0 commit comments

Comments
 (0)