def execute_runner(runner, workunit_factory=None, workunit_name=None, workunit_labels=None, workunit_log_config=None):
 if (not isinstance(runner, Executor.Runner)):
  raise ValueError(u'The runner argument must be a java Executor.Runner instance, given {} of type {}'.format(runner, type(runner)))
 if (workunit_factory is None):
  return runner.run()
 else:
  workunit_labels = ([WorkUnitLabel.TOOL, (WorkUnitLabel.NAILGUN if isinstance(runner.executor, NailgunExecutor) else WorkUnitLabel.JVM)] + (workunit_labels or []))
  with workunit_factory(name=workunit_name, labels=workunit_labels, cmd=runner.cmd, log_config=workunit_log_config) as workunit:
   ret = runner.run(stdout=workunit.output(u'stdout'), stderr=workunit.output(u'stderr'))
   workunit.set_outcome((WorkUnit.FAILURE if ret else WorkUnit.SUCCESS))
   return ret

def execute_runner ( runner , workunit_factory = None , workunit_name = None , workunit_labels = None , workunit_log_config = None ) : if ( not isinstance ( runner , Executor . Runner ) ) : raise ValueError ( u'The runner argument must be a java Executor.Runner instance, given {} of type {}' . format ( runner , type ( runner ) ) ) if ( workunit_factory is None ) : return runner . run ( ) else : workunit_labels = ( [ WorkUnitLabel . TOOL , ( WorkUnitLabel . NAILGUN if isinstance ( runner . executor , NailgunExecutor ) else WorkUnitLabel . JVM ) ] + ( workunit_labels or [ ] ) ) with workunit_factory ( name = workunit_name , labels = workunit_labels , cmd = runner . cmd , log_config = workunit_log_config ) as workunit : ret = runner . run ( stdout = workunit . output ( u'stdout' ) , stderr = workunit . output ( u'stderr' ) ) workunit . set_outcome ( ( WorkUnit . FAILURE if ret else WorkUnit . SUCCESS ) ) return ret
executes the given java runner .