[ 
https://issues.apache.org/jira/browse/SDAP-121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16540391#comment-16540391
 ] 

ASF GitHub Bot commented on SDAP-121:
-------------------------------------

fgreg closed pull request #20: SDAP-121 Make use of session optional
URL: https://github.com/apache/incubator-sdap-nexus/pull/20
 
 
   

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 b542dba..1fe024f 100644
--- a/client/nexuscli/nexuscli.py
+++ b/client/nexuscli/nexuscli.py
@@ -59,7 +59,7 @@
 session = requests.session()
 
 
-def set_target(url):
+def set_target(url, use_session=True):
     """
     Set the URL for the NEXUS webapp endpoint.  
     
@@ -69,6 +69,10 @@ def set_target(url):
     global target
     target = url
 
+    if not use_session:
+        global session
+        session = requests
+
 
 def dataset_list():
     """
diff --git a/client/nexuscli/test/nexuscli_test.py 
b/client/nexuscli/test/nexuscli_test.py
index 61a7e46..ec5c12e 100644
--- a/client/nexuscli/test/nexuscli_test.py
+++ b/client/nexuscli/test/nexuscli_test.py
@@ -22,6 +22,11 @@
 
 
 class TestCli(unittest.TestCase):
+
+    def setUp(self):
+        super().setUp()
+        nexuscli.set_target("http://localhost:8083";, use_session=False)
+
     def test_time_series(self):
         ts = nexuscli.time_series(("AVHRR_OI_L4_GHRSST_NCEI", 
"MEASURES_SLA_JPL_1603"), box(-150, 45, -120, 60),
                                   datetime(2016, 1, 1), datetime(2016, 12, 31))
@@ -42,10 +47,10 @@ def test_daily_difference_average(self):
 
     def test_data_in_bounds_with_metadata_filter(self):
         subset = nexuscli.subset("MUR-JPL-L4-GLOB-v4.1", None, datetime(2018, 
1, 1), datetime(2018, 1, 2),
-                                         None, 
["id:60758e00-5721-3a6e-bf57-78448bb0aeeb"])
+                                 None, 
["id:60758e00-5721-3a6e-bf57-78448bb0aeeb"])
         print(subset)
 
     def test_data_in_bounds_with_bounding_box(self):
         subset = nexuscli.subset("MUR-JPL-L4-GLOB-v4.1", box(-150, 45, -149, 
46), datetime(2018, 1, 1),
-                                         datetime(2018, 1, 1), None, None)
+                                 datetime(2018, 1, 1), None, None)
         print(subset)


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> Get Request Hangs
> -----------------
>
>                 Key: SDAP-121
>                 URL: https://issues.apache.org/jira/browse/SDAP-121
>             Project: Apache Science Data Analytics Platform
>          Issue Type: Bug
>          Components: nexus
>            Reporter: Frank Greguska
>            Assignee: Frank Greguska
>            Priority: Critical
>
> I frequently run into a problem where it seems like requests for '/list' and 
> other endpoint (that are not '/') hang forever. One request will work and 
> then the next request won't.
> After doing some testing from a Jupyter notebook it seems like it might have 
> something to do with the way the server is handling TCP connections. 
> If I try to use a requests.Session to issue consecutive calls to '/list', the 
> first request works and the second one just hangs. However, if I simply use 
> requests.get() and close the connection on each request, then I can send 
> multiple requests consecutively.
> Need to investigate this more and figure out why this is happening



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to