<s> import argparse <EOL> import os , sys , time , signal <EOL> amount = <NUM_LIT:0> <EOL> def destroyNetwork ( nodes ) : <EOL> print '<STR_LIT>' <EOL> i = <NUM_LIT:0> <EOL> for node in nodes : <EOL> i += <NUM_LIT:1> <EOL> hashAmount = i * <NUM_LIT:50> / amount <EOL> hashbar = '<STR_LIT:#>' * hashAmount <EOL> output = '<STR_LIT>' % ( hashbar , i , amount ) <EOL> sys . stdout . write ( output ) <EOL> time . sleep ( <NUM_LIT> ) <EOL> os . kill ( node , signal . SIGTERM ) <EOL> print <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , <EOL> help = "<STR_LIT>" , <EOL> type = int ) <EOL> parser . add_argument ( "<STR_LIT>" , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> global amount <EOL> amount = args . amount_of_nodes <EOL> if args . nic_ip_address : <EOL> ipAddress = args . nic_ip_address <EOL> else : <EOL> import socket <EOL> ipAddress = socket . gethostbyname ( socket . gethostname ( ) ) <EOL> print '<STR_LIT>' % ipAddress <EOL> startPort = <NUM_LIT> <EOL> port = startPort + <NUM_LIT:1> <EOL> nodes = [ ] <EOL> print '<STR_LIT>' <EOL> try : <EOL> nodes . append ( os . spawnlp ( os . P_NOWAIT , '<STR_LIT>' , '<STR_LIT>' , str ( startPort ) ) ) <EOL> for i in range ( amount - <NUM_LIT:1> ) : <EOL> time . sleep ( <NUM_LIT> ) <EOL> hashAmount = i * <NUM_LIT:50> / amount <EOL> hashbar = '<STR_LIT:#>' * hashAmount <EOL> output = '<STR_LIT>' % ( hashbar , i , amount ) <EOL> sys . stdout . write ( output ) <EOL> nodes . append ( os . spawnlp ( os . P_NOWAIT , '<STR_LIT>' , '<STR_LIT>' , str ( port ) , ipAddress , str ( startPort ) ) ) <EOL> port += <NUM_LIT:1> <EOL> except KeyboardInterrupt : <EOL> '<STR_LIT>' <EOL> destroyNetwork ( nodes ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> print '<STR_LIT>' <EOL> try : <EOL> while <NUM_LIT:1> : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> except KeyboardInterrupt : <EOL> pass <EOL> finally : <EOL> destroyNetwork ( nodes ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
