Beispiel #1
0
def heron_class(class_name, lib_jars, extra_jars=[], args=[], javaDefines=[]):
    # Format all java -D options that need to be passed while running
    # the class locally.
    javaOpts = map(lambda opt: '-D' + opt, javaDefines)

    # Construct the command line for the sub process to run
    # Because of the way Python execute works,
    # the java opts must be passed as part of the list
    all_args = [
        utils.get_java_path(), "-client", "-Xmx1g", opts.get_heron_config()] + \
        javaOpts + \
        ["-cp", utils.get_classpath(lib_jars + extra_jars),
    ]

    all_args += [class_name] + list(args)

    # print the verbose message
    if opts.verbose():
        print('$> %s' % ' '.join(all_args))

    # invoke the command with subprocess and print error message, if any
    if not opts.trace_execution():
        status = subprocess.call(all_args)
        if status != 0:
            err_str = "User main failed with status %d. Bailing out..." % status
            raise RuntimeError(err_str)
Beispiel #2
0
def heron_class(class_name, lib_jars, extra_jars=[], args=[], javaDefines=[]):
  # Format all java -D options that need to be passed while running
  # the class locally.
  javaOpts = map(lambda opt: '-D' + opt, javaDefines)

  # Construct the command line for the sub process to run
  # Because of the way Python execute works,
  # the java opts must be passed as part of the list
  all_args = [
      utils.get_java_path(), "-client", "-Xmx1g", opts.get_heron_config()] + \
      javaOpts + \
      ["-cp", utils.get_classpath(lib_jars + extra_jars),
  ]

  all_args += [class_name] + list(args)

  # print the verbose message
  if opts.verbose():
    print('$> %s' % ' '.join(all_args))

  # invoke the command with subprocess and print error message, if any
  if not opts.trace_execution():
    status = subprocess.call(all_args)
    if status != 0:
      err_str = "User main failed with status %d. Bailing out..." % status
      raise RuntimeError(err_str)
Beispiel #3
0
def heron_class(class_name,
                lib_jars,
                extra_jars=None,
                args=None,
                java_defines=None):
    '''
  Execute a heron class given the args and the jars needed for class path
  :param class_name:
  :param lib_jars:
  :param extra_jars:
  :param args:
  :param javaDefines:
  :return:
  '''
    # default optional params to empty list if not provided
    if extra_jars is None:
        extra_jars = []
    if args is None:
        args = []
    if java_defines is None:
        java_defines = []

    # Format all java -D options that need to be passed while running
    # the class locally.
    java_opts = ['-D' + opt for opt in java_defines]

    # Construct the command line for the sub process to run
    # Because of the way Python execute works,
    # the java opts must be passed as part of the list
    all_args = [utils.get_java_path(), "-client", "-Xmx1g", opts.get_heron_config()] + \
               java_opts + \
               ["-cp", utils.get_classpath(lib_jars + extra_jars)]

    all_args += [class_name] + list(args)

    # print the verbose message
    if opts.verbose():
        print '$> %s' % ' '.join(all_args)

    # invoke the command with subprocess and print error message, if any
    if not opts.trace_execution():
        status = subprocess.call(all_args)
        if status != 0:
            err_str = "User main failed with status %d. Bailing out..." % status
            raise RuntimeError(err_str)
Beispiel #4
0
def heron_class(class_name, lib_jars, extra_jars=None, args=None, java_defines=None):
  '''
  Execute a heron class given the args and the jars needed for class path
  :param class_name:
  :param lib_jars:
  :param extra_jars:
  :param args:
  :param javaDefines:
  :return:
  '''
  # default optional params to empty list if not provided
  if extra_jars is None:
    extra_jars = []
  if args is None:
    args = []
  if java_defines is None:
    java_defines = []

  # Format all java -D options that need to be passed while running
  # the class locally.
  java_opts = ['-D' + opt for opt in java_defines]

  # Construct the command line for the sub process to run
  # Because of the way Python execute works,
  # the java opts must be passed as part of the list
  all_args = [utils.get_java_path(), "-client", "-Xmx1g", opts.get_heron_config()] + \
             java_opts + \
             ["-cp", utils.get_classpath(lib_jars + extra_jars)]

  all_args += [class_name] + list(args)

  # print the verbose message
  if opts.verbose():
    print '$> %s' % ' '.join(all_args)

  # invoke the command with subprocess and print error message, if any
  if not opts.trace_execution():
    status = subprocess.call(all_args)
    if status != 0:
      err_str = "User main failed with status %d. Bailing out..." % status
      raise RuntimeError(err_str)