nicknezis commented on code in PR #3786:
URL: https://github.com/apache/incubator-heron/pull/3786#discussion_r846385023
##########
heron/tools/common/src/python/clients/tracker.py:
##########
@@ -122,27 +122,26 @@ def strip_whitespace(s):
backpressure=backpressure
)
-def api_get(url: str, params=None) -> dict:
+def api_get(url: str, params=None) -> Any:
"""Make a GET request to a tracker URL and return the result."""
start = time.time()
try:
+ Log.debug(f"Requesting URL: {url} with params: {params}")
response = requests.get(url, params)
response.raise_for_status()
except Exception as e:
- Log.error(f"Unable to get response from {url}: {e}")
+ Log.error(f"Unable to get response from {url} with params {params}: {e}")
return None
end = time.time()
data = response.json()
- if data["status"] != "success":
- Log.error("error from tracker: %s", data["message"])
+ if response.status_code != requests.codes.ok:
+ Log.error("error from tracker: %s", response.status_code)
return None
- execution = data["executiontime"] * 1000
duration = (end - start) * 1000
- Log.debug(f"URL fetch took {execution:.2}ms server time for {url}")
Log.debug(f"URL fetch took {duration:.2}ms round trip time for {url}")
- return data["result"]
+ return data
Review Comment:
Correct. The Tracker API no longer has the envelope. So now there is not an
embedded `result` field. The decoded json is the result.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]