You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by GitBox <gi...@apache.org> on 2018/06/21 09:21:42 UTC

[GitHub] Code0x58 commented on a change in pull request #2929: Make TopologyBuilder less permissive

Code0x58 commented on a change in pull request #2929: Make TopologyBuilder less permissive
URL: https://github.com/apache/incubator-heron/pull/2929#discussion_r197065884
 
 

 ##########
 File path: heronpy/api/topology.py
 ##########
 @@ -194,24 +194,25 @@ def get_heron_options_from_env():
 
     Currently supports the following options natively:
 
-    - `cmdline.topologydefn.tmpdirectory`: the directory to which this
+    - `cmdline.topologydefn.tmpdirectory`: (required) the directory to which this
     topology's defn file is written
-    - `cmdline.topology.initial.state`: the initial state of the topology
-    - `cmdline.topology.name`: topology name on deployment
+    - `cmdline.topology.initial.state`: (default: "RUNNING") the initial state of the topology
+    - `cmdline.topology.name`: (default: class name) topology name on deployment
 
     Returns: map mapping from key to value
     """
-    heron_options_raw = os.environ.get("HERON_OPTIONS", None)
+    heron_options_raw = os.environ.get("HERON_OPTIONS")
     if heron_options_raw is None:
       raise RuntimeError("HERON_OPTIONS environment variable not found")
 
-    ret = {}
-    heron_opt_list = heron_options_raw.replace("%%%%", " ").split(',')
-    for opt_raw in heron_opt_list:
-      opt = opt_raw.split("=")
-      if len(opt) == 2:
-        ret[opt[0]] = opt[1]
-    return ret
+    options = {}
+    for option_line in heron_options_raw.replace("%%%%", " ").split(','):
 
 Review comment:
   This feels a bit odd, I haven't seen the format elsewhere - is it used in Java? Maybe JSON would be better as it is just `os.environ["HERON_OPTIONS"] = json.dumps(config)` and `json.loads(os.envrion["HERON_OPTIONS"])` with `KeyError` and `ValueError` handling around the latter.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services