Skip to content

snakemake produce Error when using "--max-jobs-per-timespan" switch #3030

@zhangxiaoxing

Description

@zhangxiaoxing

Snakemake version

snakemake-minimal 8.18.0 pyhdfd78af_0 bioconda

Describe the bug

snakemake produce Error when using "--max-jobs-per-timespan" switch.

Logs

$ snakemake -s snake_test --max-jobs-per-timespan 1/1s -c 1 --verbose
Assuming unrestricted shared filesystem usage.
Building DAG of jobs...
shared_storage_local_copies: True
remote_exec: False
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job        count
-------  -------
testmax        1
tt            20
total         21

Resources before job selection: {'_cores': 1, '_nodes': 9223372036854775807, '_job_count': 9223372036854775807}
Ready jobs (20)
Select jobs to execute...
Welcome to the CBC MILP Solver
Version: 2.10.11
Build Date: Jun  6 2024

command line - cbc /tmp/b914c8533789440d987bb6466327145a-pulp.mps -max -timeMode elapsed -branch -printingOptions all -solution /tmp/b914c85337894
40d987bb6466327145a-pulp.sol (default strategy 1)
At line 2 NAME          MODEL
At line 3 ROWS
At line 8 COLUMNS
At line 129 RHS
At line 133 BOUNDS
At line 154 ENDATA
Problem MODEL has 3 rows, 20 columns and 60 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Continuous objective value is 2 - 0.23 seconds
Cgl0004I processed model has 0 rows, 0 columns (0 integer (0 of which binary)) and 0 elements
Cbc3007W No integer variables - nothing to do
Cuts at root node changed objective from 2 to 1.79769e+308
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value:                2.00000000
Enumerated nodes:               0
Total iterations:               0
Time (CPU seconds):             0.47
Time (Wallclock seconds):       0.01

Option for printingOptions changed from normal to all
Total time (CPU seconds):       0.93   (Wallclock seconds):       0.01

Selected jobs (1)
Resources after job selection: {'_cores': 0, '_nodes': 9223372036854775806, '_job_count': 1}
Execute 1 jobs...

[Mon Aug 19 16:12:12 2024]
localrule tt:
    output: test14.test
    jobid: 15
    reason: Missing output files: test14.test
    wildcards: idx=14
    resources: tmpdir=/tmp

Completion of job ['tt'] reported to scheduler.
jobs registered as running before removal {tt}
[Mon Aug 19 16:12:13 2024]
Finished job 15.
1 of 21 steps (5%) done
Resources before job selection: {'_cores': 1, '_nodes': 9223372036854775807, '_job_count': 2}
Ready jobs (19)
Select jobs to execute...
Job rate limit reached, waiting for free slots.
unlocking
removing lock
removing lock
removed all locks
Full Traceback (most recent call last):
  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/cli.py", line 2116, in args_to_api
    dag_api.execute_workflow(
  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/api.py", line 594, in execute_workflow
    workflow.execute(
  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/workflow.py", line 1261, in execute
    raise e
  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/workflow.py", line 1257, in execute
    success = self.scheduler.schedule()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/scheduler.py", line 279, in schedule
    f"Selected jobs ({len(run)})"
                      ^^^^^^^^
TypeError: object of type 'NoneType' has no len()

Traceback (most recent call last):

  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/cli.py", line 2116, in args_to_api
    dag_api.execute_workflow(

  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/api.py", line 594, in execute_workflow
    workflow.execute(

  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/workflow.py", line 1261, in execute
    raise e

  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/workflow.py", line 1257, in execute
    success = self.scheduler.schedule()
              ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/zhangxx/conda/snakemake_py312/lib/python3.12/site-packages/snakemake/scheduler.py", line 279, in schedule
    f"Selected jobs ({len(run)})"

Minimal example

Using this test snakefile:

rule testmax:
    input:
        lambda wildcard:[f"test{rpt:0>2}.test" for rpt in range(0,20)]
rule tt:
    output:
        "test{idx}.test"
    shell:
        "touch test{wildcards.idx}.test"

This command produces error:
snakemake -s snake_test --max-jobs-per-timespan 1/1s -c 1

but this runs fine:
snakemake -s snake_test -c 1

Additional context

hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge                                                                 [38/1872]
idna                      3.7                pyhd8ed1ab_0    conda-forge
immutables                0.20            py312h98912ed_1    conda-forge
importlib_resources       6.4.0              pyhd8ed1ab_0    conda-forge
jinja2                    3.1.4              pyhd8ed1ab_0    conda-forge
jsonschema                4.23.0             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.12.1          pyhd8ed1ab_0    conda-forge
jupyter_core              5.7.2           py312h7900ff3_0    conda-forge
ld_impl_linux-64          2.40                 hf3520f5_7    conda-forge
libblas                   3.9.0           23_linux64_openblas    conda-forge
libcblas                  3.9.0           23_linux64_openblas    conda-forge
libexpat                  2.6.2                h59595ed_0    conda-forge
libffi                    3.4.4                h6a678d5_1
libgcc-ng                 14.1.0               h77fa898_0    conda-forge
libgfortran-ng            14.1.0               h69a702a_0    conda-forge
libgfortran5              14.1.0               hc5f4f2c_0    conda-forge
libgomp                   14.1.0               h77fa898_0    conda-forge
liblapack                 3.9.0           23_linux64_openblas    conda-forge
liblapacke                3.9.0           23_linux64_openblas    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.27          pthreads_hac2b453_1    conda-forge
libsqlite                 3.46.0               hde9e2c9_0    conda-forge
libstdcxx-ng              14.1.0               hc0a3c3a_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.3.1                h4ab18f5_1    conda-forge
markupsafe                2.1.5           py312h98912ed_0    conda-forge
nbformat                  5.10.4             pyhd8ed1ab_0    conda-forge
ncurses                   6.5                  h59595ed_0    conda-forge
openssl                   3.3.1                h4bc722e_2    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pip                       24.2               pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
plac                      1.4.3              pyhd8ed1ab_0    conda-forge
platformdirs              4.2.2              pyhd8ed1ab_0    conda-forge
psutil                    6.0.0           py312h9a8786e_0    conda-forge
pulp                      2.8.0           py312h7900ff3_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.2              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.12.5          h2ad013b_0_cpython    conda-forge
python-fastjsonschema     2.20.0             pyhd8ed1ab_0    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pyyaml                    6.0.2           py312h41a817b_0    conda-forge
readline                  8.2                  h8228510_1    conda-forge
referencing               0.35.1             pyhd8ed1ab_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_0    conda-forge
reretry                   0.11.8             pyhd8ed1ab_0    conda-forge
rpds-py                   0.20.0          py312hf008fa9_0    conda-forge
setuptools                72.1.0             pyhd8ed1ab_0    conda-forge
smart_open                7.0.4              pyhd8ed1ab_0    conda-forge
smmap                     5.0.0              pyhd8ed1ab_0    conda-forge
snakemake-executor-plugin-cluster-generic 1.0.9              pyhdfd78af_0    bioconda
snakemake-interface-common 1.17.2             pyhdfd78af_0    bioconda
snakemake-interface-executor-plugins 9.2.0              pyhdfd78af_0    bioconda
snakemake-interface-report-plugins 1.0.0              pyhdfd78af_0    bioconda
snakemake-interface-storage-plugins 3.2.3              pyhdfd78af_0    bioconda
snakemake-minimal         8.18.0             pyhdfd78af_0    bioconda
sqlite                    3.46.0               h6d4b2fc_0    conda-forge
stopit                    1.1.2                      py_0    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
throttler                 1.2.2              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
toposort                  1.10               pyhd8ed1ab_0    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   2.2.2              pyhd8ed1ab_1    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
wrapt                     1.16.0          py312h98912ed_0    conda-forge
xz                        5.4.6                h5eee18b_1
yaml                      0.2.5                h7f98852_2    conda-forge
yte                       1.5.4              pyha770c72_0    conda-forge
zipp                      3.19.2             pyhd8ed1ab_0    conda-forge
zlib                      1.3.1                h4ab18f5_1    conda-forge
zstandard                 0.23.0          py312h3483029_0    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions