Пример #1
0
    if numInputs < numThreads:
        print 'Reducing # threads to ' + str(
            numInputs) + ' since this is how many inputs are in the file'
        numThreads = numInputs

    ###################################################################################################
    #	START EXECUTION
    ###################################################################################################
    outFile = open(rawResultsFilePath, 'wb')
    csvWriter = csv.writer(outFile, delimiter=',', quotechar='"')
    csvWriter.writerow(headerRow + ['APIURL', 'JSON'])
    threads = []
    #initialize threads
    for i in range(0, numThreads):
        threads.append(wppbatchlib.apiThread(i, csvWriter, testInputs))

    print 'Execution has begun...'

    for i in range(0, numThreads):
        threads[i].start()

    for t in threads:
        t.join()
    print 'All done! Raw results written to: ' + str(rawResultsFilePath)

    outFile.flush()
    outFile.close()
except:
    print 'An unexpected error occurred running inputs: ' + str(
        sys.exc_info()[0])
			doneWithFile = True
		
	if numInputs < numThreads:
		print 'Reducing # threads to '+str(numInputs)+' since this is how many inputs are in the file'
		numThreads = numInputs
		
	###################################################################################################
	#	START EXECUTION
	###################################################################################################
	outFile = open(rawResultsFilePath,'wb')
	csvWriter = csv.writer(outFile,delimiter=',',quotechar='"')
	csvWriter.writerow(headerRow+['APIURL','JSON'])
	threads = []
	#initialize threads
	for i in range(0,numThreads):
		threads.append(wppbatchlib.apiThread(i,csvWriter,testInputs))

	print 'Execution has begun...'
		
	for i in range(0,numThreads):
		threads[i].start()		
		
	for t in threads:
		t.join()
	print 'All done! Raw results written to: '+str(rawResultsFilePath)
	
	outFile.flush()
	outFile.close()
except:
	print 'An unexpected error occurred running inputs: '+str(sys.exc_info()[0])