<s> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> from __future__ import absolute_import <EOL> import os , sys , dispy <EOL> if - <NUM_LIT:1> != sys . path [ <NUM_LIT:0> ] . find ( '<STR_LIT>' ) : raise Exception ( '<STR_LIT>' ) <EOL> importDir = os . path . join ( os . path . join ( sys . path [ <NUM_LIT:0> ] [ : sys . path [ <NUM_LIT:0> ] . rfind ( os . sep ) ] , '<STR_LIT:..>' ) , '<STR_LIT:..>' ) <EOL> if importDir not in sys . path : <EOL> sys . path . append ( importDir ) <EOL> import pyeq2 <EOL> def fitEquationUsingDispyCluster ( inEquationString , inFittingTargetString , inExtendedVersionString , inTextData ) : <EOL> import pyeq2 <EOL> exec ( '<STR_LIT>' + inEquationString + '<STR_LIT>' + inFittingTargetString + '<STR_LIT>' + inExtendedVersionString + '<STR_LIT>' ) <EOL> pyeq2 . dataConvertorService ( ) . ConvertAndSortColumnarASCII ( inTextData , equation , False ) <EOL> equation . Solve ( ) <EOL> fittedTarget = equation . CalculateAllDataFittingTarget ( equation . solvedCoefficients ) <EOL> return [ fittedTarget , inEquationString , equation . solvedCoefficients ] <EOL> equationString = '<STR_LIT>' <EOL> fittingTargetString = '<STR_LIT>' <EOL> textData = '''<STR_LIT>''' <EOL> jobCount = <NUM_LIT:20> <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> cluster = dispy . JobCluster ( fitEquationUsingDispyCluster ) <EOL> print ( '<STR_LIT>' , jobCount , '<STR_LIT>' ) <EOL> jobs = [ ] <EOL> for i in range ( jobCount ) : <EOL> job = cluster . submit ( equationString , fittingTargetString , '<STR_LIT>' , textData ) <EOL> job . id = i <EOL> jobs . append ( job ) <EOL> print ( '<STR_LIT>' ) <EOL> for job in jobs : <EOL> print ( ) <EOL> results = job ( ) <EOL> if job . exception : <EOL> print ( '<STR_LIT>' , job . id , '<STR_LIT:\n>' , str ( job . exception ) ) <EOL> else : <EOL> equationString = '<STR_LIT>' + results [ <NUM_LIT:1> ] + '<STR_LIT>' + fittingTargetString + '<STR_LIT>' <EOL> exec ( equationString ) <EOL> print ( '<STR_LIT>' , job . id ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) </s>
