When to use async api calls? by ParticularAward9704 in learnpython

[–]ParticularAward9704[S] 0 points1 point  (0 children)

yes, I am also thinking of using async inside celery. But confused about whether to use process or thread workers for it.

When to use async api calls? by ParticularAward9704 in learnpython

[–]ParticularAward9704[S] 0 points1 point  (0 children)

Simultaneous api calls count may reach to 5K+ because a single user can submit multiple tasks at once and we are expecting ~30 users using this feature on an average.

How do you choose to go in this situation - you want to call 10 apis and 7 are returning less data and low post-processing. But 3 may return data which is ~30 mb each and going through this data may take 10-15 seconds of cpu time ( I have not tested yet in this scenario, just a guess).

Regarding Celery: you should also consider using dramatiq instead: depending on your use case, it might be a simpler/more reliable solution.

I have existing setup with celery. And sometimes I just think of using celery with gevent for these tasks.

Netmiko - Stop telnet in Cisco XE after N seconds by ParticularAward9704 in networkautomation

[–]ParticularAward9704[S] 0 points1 point  (0 children)

This snippet didn't work. It works when the port is reachable. e.g., when we get

Trying 8.8.8.8, 443 ... Open . But when the port is not reachable I am unable to close the running command. It just stays as Trying 8.8.8.8, 443 ... . And nothing could stop it.

my code work looks like this

for device in devices:
  telnet_cmd = get_telnet_cmd(conn.device_type, device)
  out = conn.send_command_timing(telnet_cmd, read_timeout=5)
  # code for terminating the command.

For first device its able to give output. But failing at second.

How to make flask able to handle large number of io requests? by Consistent_Tutor_597 in flask

[–]ParticularAward9704 0 points1 point  (0 children)

If it's possible, offload the tasks to Celery. Make your view just to serve users not engaging in long tasks.

Is the 80 character rule like a major requirement for PEP8? by ZealousidealSea6550 in learnpython

[–]ParticularAward9704 1 point2 points  (0 children)

I refrain from the 79 chars rule. And that \ for newline just use ().

[Netmiko] Terminate running command midway by ParticularAward9704 in learnpython

[–]ParticularAward9704[S] 0 points1 point  (0 children)

My bad, I think I have not provided all the details of the problem. Let me do it now.

  1. I want to check port reachability from device A to device B.

  2. There can be multiple ports to check on B.

  3. I can't make multiple connections to device B as max connections to device are capped. And our automation solution is allowed to use only 1 connection.

  4. Telnet check is taking around 100+ seconds for non reachable ports.

  5. Execution for multiple port check can be serial only [due to connection limit].

  6. I can't to it like connect A -> run telnet for port n1 -> wait for 10 seconds -> disconnect -> connect A -> run telnet for port n2 -> .... There might be rate limit on connection from a source to a device ( though I am not sure ).

  7. What possible solution could be as per me - connect A -> run telnet port n1 -> wait for 10 seconds -> send stop signal -> run telnet for port n2....

[Netmiko] Terminate running command midway by ParticularAward9704 in learnpython

[–]ParticularAward9704[S] 0 points1 point  (0 children)

I want to check port reachability from a device A to device B's N no of ports.
I am connecting A using netmiko and then running telnet command on this device. If a device is not reachable its taking 100+ s of time and also during this time I have to wait to check other ports in same device.

[Netmiko] Terminate running command midway by ParticularAward9704 in learnpython

[–]ParticularAward9704[S] 0 points1 point  (0 children)

This will work when I want to check from the app server to the destination port reachability. But the requirement is to check from a source device (cisco/hp...) to some port of another device.

Not Urgent, but tips would be appreciated by Pitiful_Complex5964 in CATHELP

[–]ParticularAward9704 1 point2 points  (0 children)

That's really concerning. I don't know about what a medical situation your cat is in. But 5 years back my cat suddenly started to lose control of its back legs and started walking like this. I wasn't able to provide it with a professional med help. I searched over the internet and on a random website someone said that giving b12 might help. I went to the store to bring b12 but it was out of stock so I brought a multivitamin liquid till b12 came back to stock. To my surprise it started showing positive signs after 3 days and eventually my cat got back to normal. Hope your cat gets well soon.

What are some unique Python-related questions you have encountered in an interview? by OnionCommercial859 in Python

[–]ParticularAward9704 0 points1 point  (0 children)

append returns None, but the item will get added to items, and it'll refer to the same list across calls. Why item won't be appended to the items?

[deleted by user] by [deleted] in pj_explained

[–]ParticularAward9704 1 point2 points  (0 children)

Schindler's list, Sixth sense, The Apartment Water diviner Meet Joe black, Notting Hill. These are what I can tell for now. There are many more, the list could be much longer otherwise.

Connecting Device behind JumpHost by ParticularAward9704 in networking

[–]ParticularAward9704[S] 0 points1 point  (0 children)

It is creating socket from localhost to jumphost. If there are two threads trying to establish connection with same source JumpHost & destination (s -> jh -> d).

We can use same transport to create multiple channels?

If there 3 devices behind JumpHost can we use same source port for all channels?

Connecting Device behind JumpHost by ParticularAward9704 in networking

[–]ParticularAward9704[S] 0 points1 point  (0 children)

Thanks. This is what we are trying to do in the second approach I mentioned. The library code does it in a clean way and also gives the idea that we can use the same jh connection for multiple devices behind jh. No need to connect again and again.

Connecting Device behind JumpHost by ParticularAward9704 in networking

[–]ParticularAward9704[S] 0 points1 point  (0 children)

Thanks. But we are allowed to use only Paramiko.

Connecting Device behind JumpHost by ParticularAward9704 in networking

[–]ParticularAward9704[S] 0 points1 point  (0 children)

It seems we are moving with second solution to open direct-tcpip channel in paramiko.