Created
August 23, 2013 17:26
-
-
Save devdave/6321851 to your computer and use it in GitHub Desktop.
romper/storm-starter for jython. Change to __run__.py Idea is to allow for arbitrary topologies to be executed BUT I don't know if this will work in the cluster submission process via storm command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
from importlib import import_module | |
from backtype.storm import Config, LocalCluster, StormSubmitter | |
#from tsync.examples.exclamation import get_topology_builder | |
def main(run_local=False): | |
parser = argparse.ArgumentParser(description="Generate a single jar for Storm") | |
parser.add_argument("topology", help="A valid topology to run/call") | |
parser.add_argument("--local", default=run_local, action="store_true", help="Run topology in a local cluster") | |
parser.add_argument("--debug", default=False, action="store_true", help="Turn on debug logging") | |
parser.add_argument("--num-workers",default=2, type=int, help="Number of workers") | |
#parser.add_argument("--name", default="romper", help="Topology name") | |
print sys.argv | |
args = parser.parse_args() | |
top_name = args.topology | |
module = import_module(top_name) | |
conf = Config() | |
conf.setDebug(args.debug) | |
conf.setNumWorkers(args.num_workers) | |
getattr(module, "main")(conf = conf) | |
#cluster = LocalCluster() if args.local else StormSubmitter | |
#builder = get_topology_builder() | |
#cluster.submitTopology(args.name, conf, builder.createTopology()) | |
print "Running under", __name__ | |
main(run_local=__name__ == "__main__") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment