runtraj.execution.runner.array_size#

runtraj.execution.runner.array_size(block, n_releases, limit)[source]#

Return the number of tasks of a job array for n_releases: n_tasks, or ten per worker.

block is the slurm or pbs block. Never more than one task per release, nor more than limit, the most tasks the cluster allows in one array (Slurm’s MaxArraySize, PBS’s max_array_size). A task runs cpus releases at once, so with n_tasks unset a task’s share is whole rounds of cpus releases: a share of 10 on 8 CPUs would leave 6 of them idle for its last 2 releases.

Examples

>>> from runtraj.execution import SlurmConfig
>>> array_size(SlurmConfig(n_workers=50), 10_000, limit=1000)
500
>>> array_size(SlurmConfig(n_workers=50, cpus=8), 10_000, limit=1000)
417
>>> array_size(SlurmConfig(n_workers=200), 10_000, limit=1000)
1000
>>> array_size(SlurmConfig(n_workers=50), 120, limit=1000)
120
Raises:

ValueError – If n_tasks is more than limit.

Return type:

int

Parameters: