Hello,
I have a list of network devices in a file (each line is a device). I am passing each device or each line of that file as an argument to a curl statement to get the interfaces from the devices. The problem is, since there are more than 20K devices - it is actually taking a lot of time to get all the interfaces.
This led me into threading and queuing module. Now, I am queuing all the devices and then running the thread. The thread contains the function to pull the interfaces.
Also, my active thread count is not incrementing.
I have a list of network devices in a file (each line is a device). I am passing each device or each line of that file as an argument to a curl statement to get the interfaces from the devices. The problem is, since there are more than 20K devices - it is actually taking a lot of time to get all the interfaces.
This led me into threading and queuing module. Now, I am queuing all the devices and then running the thread. The thread contains the function to pull the interfaces.
with open("filtered_devices") as my_file: for line in my_file: q.put(line) numofThreads = 10. for i in range (numofThreads): print str(threading.activeCount()) t = threading.Thread(target = queue_interfaces()) t.start() #threadlist.append(t)Here, queue_interfaces() is the function that passes each devices as as argument and gets the interfaces. Not sure if this is the correct way to do that. May be I am doing it wrong, since the time is still the same. Can somebody please advise?
Also, my active thread count is not incrementing.