max-jobs-per-second not working with float

Create issue
Issue #1236 resolved
Former user created an issue


Documentation states:

--max-jobs-per-second Maximal number of cluster/drmaa jobs per second, default is 10, fractions allowed. Default: 10

The problem is that even though they do no raise any error, values below 1 are ignored (1 job per second will be submitted). This is due to the way RateLimiter works.

If we want to allow users to submit less than 1 job per second, we need to play with the max_calls and period parameters of RateLimiter. For instance, replacing:

if self.max_jobs_per_second and not self.dryrun:
    self.rate_limiter = RateLimiter(max_calls=self.max_jobs_per_second,


from fractions import Fraction
if self.max_jobs_per_second and not self.dryrun:
    max_jobs_frac = Fraction(self.max_jobs_per_second).limit_denominator()
    self.rate_limiter = RateLimiter(max_calls=max_jobs_frac.numerator,

The code above should work with any value of max_jobs_per_second, and ensure that floating value are properly taken into account.



Comments (2)

  1. Log in to comment