Thread within for loop

Iranna Mathapati iranna.gani28 at gmail.com
Sat Apr 1 02:58:08 EDT 2017


Hi team,

I tried to run fallowing run,

        *jobs = []*
*        sniffer1 = threading.Thread(target=validate_traffic_stats_dy,args=
 (FT_item_dy,RT_item_dy,forward_path_list_dy,return_path_list_dy,nat_type_list_dy,pkt_dy_1,))*
*        jobs.append(sniffer1)*

*        sniffer2 =
threading.Thread(target=validate_traffic_stats_st,args=(FT_item_st,RT_item_st,forward_path_list_st,return_path_list_st,nat_type_list_st,pkt_st,))*
*        jobs.append(sniffer2)*

*       for local_ip, global_ip in zip(src_ipv4_local_list_st_in_new,
src_ipv4_global_list_st_in_new):*
*            sniffer3 =
threading.Thread(target=create_static_nat_entries,args = (uut2_hdl2,
direction_in, local_ip,global_ip,))*
*            jobs.append(sniffer3) *

*        # Start the threads*
*        for j in jobs:*
*            j.start()*
*            time.sleep(2)*

*        # Ensure all of the threads have finished*
*        for j in jobs:*
*  j.join()*

while runing i got below error and hitting in sniffer3 thread

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/auto/pysw/cel55/python/2.7.8/lib/python2.7/threading.py", line
810, in __bootstrap_inner
    self.run()
  File "/auto/pysw/cel55/python/2.7.8/lib/python2.7/threading.py", line
763, in run
    self.__target(*self.__args, **self.__kwargs)
  File
"/auto/n3k-qa/regression/pyATS2/hlite/eor/systest/scripts/NAT/feature_nat_lib.py",
line 50, in create_static_nat_entries
    {2} add-route'.format(protocol, inside_local_ip, inside_global_ip))
  File "../../lib/icon.py", line 899, in iconfig
    self.hdl.expect('# $')
  File
"/auto/n3k-qa/CODC/ianandan/pyATS2.7/lib/python2.7/site-packages/pexpect/__init__.py",
line 1451, in expect
    timeout, searchwindowsize)
  File
"/auto/n3k-qa/CODC/ianandan/pyATS2.7/lib/python2.7/site-packages/pexpect/__init__.py",
line 1466, in expect_list
    timeout, searchwindowsize)
  File
"/auto/n3k-qa/CODC/ianandan/pyATS2.7/lib/python2.7/site-packages/pexpect/__init__.py",
line 1568, in expect_loop
    raise TIMEOUT(str(err) + '\n' + str(self))
TIMEOUT: Timeout exceeded.
<pexpect.spawn object at 0xf634688c>
version: 3.3
command: /usr/bin/telnet
args: ['/usr/bin/telnet', '172.31.205.170', '2025']
searcher: <pexpect.searcher_re object at 0xf616396c>
buffer (last 100 chars): '\rSeoul(config)# config
terminal\r\r\n\r\r\nend\r\r\n'
before (last 100 chars): '\rSeoul(config)# config
terminal\r\r\n\r\r\nend\r\r\n'
after: <class 'pexpect.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 17297
child_fd: 8
closed: False
timeout: 500
delimiter: <class 'pexpect.EOF'>
logfile: <open file
'/auto/n3k-qa/regression/pyATS2/users/root/runinfo/Add_Static_traffic_check_job.2017Mar31_23:29:43/TaskLog.__task1',
mode 'a' at 0xf63193e8>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1


Can you please let me know what is the issue.


Thanks,
Iranna M



More information about the Python-list mailing list