def run_python_job(job):
 log('Running python job.\n')
 sys.path.append(os.path.realpath(job.expt_dir))
 params = {}
 for param in job.param:
  dbl_vals = param.dbl_val._values
  int_vals = param.int_val._values
  str_vals = param.str_val._values
  if (len(dbl_vals) > 0):
   params[param.name] = np.array(dbl_vals)
  elif (len(int_vals) > 0):
   params[param.name] = np.array(int_vals, dtype=int)
  elif (len(str_vals) > 0):
   params[param.name] = str_vals
  else:
   raise Exception('Unknown parameter type.')
 module = __import__(job.name)
 result = module.main(job.id, params)
 log(('Got result %f\n' % result))
 job.value = result
 save_job(job)

def run_python_job ( job ) : log ( 'Running python job.\n' ) sys . path . append ( os . path . realpath ( job . expt_dir ) ) params = { } for param in job . param : dbl_vals = param . dbl_val . _values int_vals = param . int_val . _values str_vals = param . str_val . _values if ( len ( dbl_vals ) > 0 ) : params [ param . name ] = np . array ( dbl_vals ) elif ( len ( int_vals ) > 0 ) : params [ param . name ] = np . array ( int_vals , dtype = int ) elif ( len ( str_vals ) > 0 ) : params [ param . name ] = str_vals else : raise Exception ( 'Unknown parameter type.' ) module = __import__ ( job . name ) result = module . main ( job . id , params ) log ( ( 'Got result %f\n' % result ) ) job . value = result save_job ( job )
run a python function .