def generate_test(machines, hostname, profilers, timeout_start, timeout_stop, timeout_sync=180):
 control_file = []
 for profiler in profilers:
  control_file.append(('job.profilers.add(%s)' % _encode_args(*profiler)))
 profiler_sync_call = (_RUNTEST_PATTERN % (timeout_sync, timeout_start, timeout_stop, hostname, _PROF_MASTER, machines))
 control_file.append(profiler_sync_call)
 for profiler in reversed(profilers):
  control_file.append(("job.profilers.delete('%s')" % profiler[0]))
 return '\n'.join(control_file)

def generate_test ( machines , hostname , profilers , timeout_start , timeout_stop , timeout_sync = 180 ) : control_file = [ ] for profiler in profilers : control_file . append ( ( 'job.profilers.add(%s)' % _encode_args ( * profiler ) ) ) profiler_sync_call = ( _RUNTEST_PATTERN % ( timeout_sync , timeout_start , timeout_stop , hostname , _PROF_MASTER , machines ) ) control_file . append ( profiler_sync_call ) for profiler in reversed ( profilers ) : control_file . append ( ( "job.profilers.delete('%s')" % profiler [ 0 ] ) ) return '\n' . join ( control_file )
generate a control file that enables profilers and starts profiler_sync .