fgreg closed pull request #24: SDAP-125 Conflict with global variable in client
URL: https://github.com/apache/incubator-sdap-nexus/pull/24
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/client/nexuscli/nexuscli.py b/client/nexuscli/nexuscli.py
index 1fe024f..c431f46 100644
--- a/client/nexuscli/nexuscli.py
+++ b/client/nexuscli/nexuscli.py
@@ -68,6 +68,7 @@ def set_target(url, use_session=True):
     """
     global target
     target = url
+    print("Target set to {}".format(target))
 
     if not use_session:
         global session
diff --git a/client/nexuscli/nexuscli_ow.py b/client/nexuscli/nexuscli_ow.py
index feae3e2..4cb7bf6 100644
--- a/client/nexuscli/nexuscli_ow.py
+++ b/client/nexuscli/nexuscli_ow.py
@@ -38,40 +38,27 @@
     valid pyspark code.  For pyspark code the variable sc may be used to 
     access the SparkContext,  but it should not create the SparkContext.
 """
-import requests
 import ast
 
-target = 'http://localhost:8084'
-
-session = requests.session()
+import requests
 
+from nexuscli import nexuscli
 
-def set_target(url, use_session=True):
-    """
-    Set the URL for the NEXUS webapp endpoint.  
-    
-    __url__ URL for NEXUS webapp endpoint   
-    __return__ None
-    """
-    global target
-    target = url
+session = requests.session()
 
-    if not use_session:
-        global session
-        session = requests
+set_target = nexuscli.set_target
 
 
 def run_file(fname):
     files = {'file': open(fname, 'rb')}
-    response = session.post(target+'/run_file', files=files)
+    response = session.post(nexuscli.target + '/run_file', files=files)
     print(response.text)
     return response.text
-    
+
 
 def run_str(code):
-    response = requests.post(target+'/run_str', data=code)
+    response = requests.post(nexuscli.target + '/run_str', data=code)
     ans = ast.literal_eval(response.text)['text/plain']
     for line in ans:
         print(line, end=" ")
     return ans
-


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to