Skip to content

Conversation

@teojgo
Copy link
Contributor

@teojgo teojgo commented Feb 28, 2018

  • Check that self._a is not smaller that a minimum allowed value.

Fixes #77

* Check that `self._a` is not smaller that a minimum allowed value.


class PollRateFunction:
_min_a = 0.01
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to have this variable defined in the settings.py?
Or Have it defined capitalized at the beginning of the file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorusu Generally, yes, but not in this issue. I will create another one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this one so that I do not enter a magic number in the middle of the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorusu Another problem with exposing _min_a as-is is that it doesn't have a physical meaning. It is not the minimum poll rate.

self._b = self._min_rate
self._a = init_rate - self._b
if self._a < self._min_a:
self._a = self._min_a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this solution. _min_a has no meaning and it is arbitrary. The problem here is that the initial rate is less than the minimum rate. Ideally, we would like to change the function and make it an increasing logarithmic. Since this is a bit too much, I would suggest the following:

if abs(self._min_rate - init_rate) < eps:
    self._a = 0
    self._c = 0
else:
    # as of now

The above function will make the subsequent calls to __call__() return always the minimum rate. The eps should have such a value to guarantee that math.log() doesn't throw.

@vkarak
Copy link
Contributor

vkarak commented Mar 1, 2018

@jenkins-cscs retry daint

@vkarak vkarak merged commit f0f81f2 into master Mar 1, 2018
@vkarak vkarak deleted the bugfix/math_error_poll_rate branch March 1, 2018 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants