Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

add option to pass any additional classpath while launching a topology #1245

Merged
merged 5 commits into from
Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion heron/cli/src/python/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def add_titles(parser):
return parser



def add_verbose(parser):
'''
:param parser:
Expand Down Expand Up @@ -143,3 +142,15 @@ def add_deactive_deploy(parser):
metavar='(a boolean; default: "false")',
default=False)
return parser


def add_extra_launch_classpath(parser):
'''
:param parser:
:return:
'''
parser.add_argument(
'--extra-launch-classpath',
metavar='(a string; additional JVM class path for launching topology)',
default="")
return parser
2 changes: 1 addition & 1 deletion heron/cli/src/python/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def heron_class(class_name, lib_jars, extra_jars=None, args=None, java_defines=N
# the java opts must be passed as part of the list
all_args = [config.get_java_path(), "-client", "-Xmx1g"] + \
java_opts + \
["-cp", config.get_classpath(lib_jars + extra_jars)]
["-cp", config.get_classpath(extra_jars + lib_jars)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

em.. why switching order here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the user defined class path should come earlier than the system or heron class path.

cheers
/karthik

On Aug 15, 2016, at 9:36 AM, Mark Li notifications@github.com wrote:

In heron/cli/src/python/execute.py #1245 (comment):

@@ -54,7 +54,7 @@ def heron_class(class_name, lib_jars, extra_jars=None, args=None, java_defines=N

the java opts must be passed as part of the list

all_args = [config.get_java_path(), "-client", "-Xmx1g"] +
java_opts + \

  •         ["-cp", config.get_classpath(lib_jars + extra_jars)]
    
  •         ["-cp", config.get_classpath(extra_jars + lib_jars)]
    
    em.. why switching order here?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/twitter/heron/pull/1245/files/88942cede245a9d6f1442e04388dc3189772eebc#r74790579, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWcRNhbHFyTSRI-xhUmTgJWpuh1-4Uaks5qgJWcgaJpZM4Jh24I.


all_args += [class_name] + list(args)

Expand Down
1 change: 0 additions & 1 deletion heron/cli/src/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def create_parser():
Main parser
:return:
'''
#parser = argparse.ArgumentParser(
parser = hrc_parse.HeronArgumentParser(
prog='heron',
epilog=HELP_EPILOG,
Expand Down
12 changes: 7 additions & 5 deletions heron/cli/src/python/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def create_parser(subparsers):
cli_args.add_topology_class(parser)
cli_args.add_config(parser)
cli_args.add_deactive_deploy(parser)
cli_args.add_extra_launch_classpath(parser)
cli_args.add_system_property(parser)
cli_args.add_verbose(parser)

Expand Down Expand Up @@ -100,12 +101,13 @@ def launch_a_topology(cl_args, tmp_dir, topology_file, topology_defn_file):
lib_jars = config.get_heron_libs(
jars.scheduler_jars() + jars.uploader_jars() + jars.statemgr_jars() + jars.packing_jars()
)
extra_jars = cl_args['extra_launch_classpath'].split(':')

# invoke the submitter to submit and launch the topology
execute.heron_class(
'com.twitter.heron.scheduler.SubmitterMain',
lib_jars,
extra_jars=[],
class_name='com.twitter.heron.scheduler.SubmitterMain',
lib_jars=lib_jars,
extra_jars=extra_jars,
args=args,
java_defines=[]
)
Expand Down Expand Up @@ -174,8 +176,8 @@ def submit_fatjar(cl_args, unknown_args, tmp_dir):
topology_file = cl_args['topology-file-name']
try:
execute.heron_class(
cl_args['topology-class-name'],
config.get_heron_libs(jars.topology_jars()),
class_name=cl_args['topology-class-name'],
lib_jars=config.get_heron_libs(jars.topology_jars()),
extra_jars=[topology_file],
args=tuple(unknown_args),
java_defines=cl_args['topology_main_jvm_property'])
Expand Down