question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to estimate `max_loops`?

See original GitHub issue

Hi!

So, according to this, the max_loops parameter is used inside the send_command as a while bound before exiting. Inside the while loop one can see that:

loop_delay=0.2
[...]
while i <= max_loops:
     [...]
     time.sleep(delay_factor * loop_delay)

This means that the maximum total time is max_loops * delay_factor * 0.2.

Now, let’s say that I want to establish a maximum timeout for reading of 400s. Then max_loops=400/(0.2*delay_factor). With delay_factor=0.5 this leads to max_loops=4000.

However I’ve tried limiting this but even though I’ve set max_loops=4000 (or maximum time of 400s) I still can run show commands for over 500s. Why is this happening?

Finally, I’ve seen also that max_loops is used in send_config_set() but there is no while-loop inside send_config_set(). How does it work in here? Is my estimation above still valid?

Regards!

Lucas

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
ktbyerscommented, Jul 9, 2021

FYI, Netmiko 4.x also has a new send_multiline and send_multiline_timing feature where you can send in a list of commands and get the output for each of those commands.

You can see some examples in the test code here:

https://github.com/ktbyers/netmiko/blob/develop/tests/test_netmiko_show.py#L267

1reaction
ktbyerscommented, Jul 9, 2021

Fair enough…just don’t ask questions of the form I am using send_config_set() for show commands and it is not working properly. 😃

This equation does not apply for send_config_set() i.e. that only applies to send_command.

max_loops = myTimeOut / ( 0.2 * delay_factor )

I am probably going to completely remove max_loops from send_config_set() in Netmiko 4.X. It was used for a different purpose and was probably very rarely used and was being deprecated anyways.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make maxLoops for fake timers configurable #8257 - GitHub
maxLoops option is mentioned as possible solution (this is the count timers that will be run), but the workaround is done through calling...
Read more >
JMeter - how to get test group's max loops? - Stack Overflow
I want to get the max number of loops in the test group. But how? I do not see anything to do with...
Read more >
Roots.cs - Risk256.com
</param> /// <param name="initialEstimate">The initial estimate of the root. ... the |y(r)| is less than convergenceCriteria or it has run through maxLoops.
Read more >
I'm confused about wcompress maxloop what is exactly doing ...
I'm confused about wcompress maxloop what is... Learn more about wcompress, ... Find more on Denoising and Compression in Help Center and File...
Read more >
arduino - issue #675 - Google Code
update -- The timeout calculation (maxloops) has a similar math overflow. See following threads for discussion of the problem ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found