[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] 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