surahman commented on a change in pull request #3786:
URL: https://github.com/apache/incubator-heron/pull/3786#discussion_r836933744
##########
File path: 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:
I think `data` is a `dict` and what you are returning is the entire
`JSON` object as a `dict` instead of the `result` entry. This is causing
failures in the tests. Have you handled this in rotuines that depend on this
return value? If so you need to update the test suite to reflect the expected
results.
--
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]