[GitHub] [incubator-sdap-nexus] RKuttruff commented on a diff in pull request #207: Insitu query logging

2022-10-25 Thread GitBox


RKuttruff commented on code in PR #207:
URL: 
https://github.com/apache/incubator-sdap-nexus/pull/207#discussion_r1004727473


##
analysis/webservice/algorithms/doms/insitu.py:
##
@@ -60,12 +66,22 @@ def query_insitu(dataset, variable, start_time, end_time, 
bbox, platform, depth_
 # Page through all insitu results
 next_page_url = insitu_endpoints.getEndpoint(provider, dataset)
 while next_page_url is not None and next_page_url != 'NA':
-if session is not None:
-response = session.get(next_page_url, params=params)
+thetime = datetime.now()
+if params == {}:
+logging.info(f"Starting insitu request: {next_page_url}")
 else:
-response = requests.get(next_page_url, params=params)
+logging.info(f"Starting insitu request: 
{next_page_url}?{urlencode(params)}")
+
+
+try:
+if session is not None:
+response = session.get(next_page_url, params=params, 
timeout=(15.05, 331))

Review Comment:
   First one is connect timeout, second is read timeout. 
   I suppose it would be beneficial to fail quickly if we can't even connect 
rather than wait a whole 5 minutes 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sdap.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [incubator-sdap-nexus] skorper commented on a diff in pull request #207: Insitu query logging

2022-10-25 Thread GitBox


skorper commented on code in PR #207:
URL: 
https://github.com/apache/incubator-sdap-nexus/pull/207#discussion_r1004725621


##
analysis/webservice/algorithms/doms/insitu.py:
##
@@ -60,12 +66,22 @@ def query_insitu(dataset, variable, start_time, end_time, 
bbox, platform, depth_
 # Page through all insitu results
 next_page_url = insitu_endpoints.getEndpoint(provider, dataset)
 while next_page_url is not None and next_page_url != 'NA':
-if session is not None:
-response = session.get(next_page_url, params=params)
+thetime = datetime.now()
+if params == {}:
+logging.info(f"Starting insitu request: {next_page_url}")
 else:
-response = requests.get(next_page_url, params=params)
+logging.info(f"Starting insitu request: 
{next_page_url}?{urlencode(params)}")
+
+
+try:
+if session is not None:
+response = session.get(next_page_url, params=params, 
timeout=(15.05, 331))

Review Comment:
   I meant why set `timeout=(15.05, 331)` rather than `timeout=331`? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sdap.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [incubator-sdap-nexus] RKuttruff commented on a diff in pull request #207: Insitu query logging

2022-10-25 Thread GitBox


RKuttruff commented on code in PR #207:
URL: 
https://github.com/apache/incubator-sdap-nexus/pull/207#discussion_r1004721938


##
analysis/webservice/algorithms/doms/insitu.py:
##
@@ -60,12 +66,22 @@ def query_insitu(dataset, variable, start_time, end_time, 
bbox, platform, depth_
 # Page through all insitu results
 next_page_url = insitu_endpoints.getEndpoint(provider, dataset)
 while next_page_url is not None and next_page_url != 'NA':
-if session is not None:
-response = session.get(next_page_url, params=params)
+thetime = datetime.now()
+if params == {}:
+logging.info(f"Starting insitu request: {next_page_url}")
 else:
-response = requests.get(next_page_url, params=params)
+logging.info(f"Starting insitu request: 
{next_page_url}?{urlencode(params)}")
+
+
+try:
+if session is not None:
+response = session.get(next_page_url, params=params, 
timeout=(15.05, 331))

Review Comment:
   Not sure what you mean by the first question.
   
   I chose the numbers (primarily 15.05) since the documentation for setting 
timeouts recommends setting it to a little bit higher than a multiple of 3, so 
I picked one admittedly arbitrarily. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sdap.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [incubator-sdap-nexus] skorper commented on a diff in pull request #207: Insitu query logging

2022-10-25 Thread GitBox


skorper commented on code in PR #207:
URL: 
https://github.com/apache/incubator-sdap-nexus/pull/207#discussion_r1004719665


##
analysis/webservice/algorithms/doms/insitu.py:
##
@@ -60,12 +66,22 @@ def query_insitu(dataset, variable, start_time, end_time, 
bbox, platform, depth_
 # Page through all insitu results
 next_page_url = insitu_endpoints.getEndpoint(provider, dataset)
 while next_page_url is not None and next_page_url != 'NA':
-if session is not None:
-response = session.get(next_page_url, params=params)
+thetime = datetime.now()
+if params == {}:
+logging.info(f"Starting insitu request: {next_page_url}")
 else:
-response = requests.get(next_page_url, params=params)
+logging.info(f"Starting insitu request: 
{next_page_url}?{urlencode(params)}")
+
+
+try:
+if session is not None:
+response = session.get(next_page_url, params=params, 
timeout=(15.05, 331))

Review Comment:
   What's the justification of setting these values separately? Also, why 331 
and not 300 (the gateway timeout we have configured)? Also curious why you 
chose 15.05
   
   Also, we should probably avoid [magic 
numbers](https://en.wikipedia.org/wiki/Magic_number_(programming)) and assign 
these values to variables



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sdap.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org