Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Echidna status checking tolerate transient failure #1856

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions document/util/check-echidna-status.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ def get_echidna_id(directory):
def get_current_response(echidna_id):
url = ECHIDNA_STATUS_URL + echidna_id
print(f'Fetching {url}')
response = requests.get(url, allow_redirects=True)
if response.status_code != 200:
tries = 3
while tries:
response = requests.get(url, allow_redirects=True)
if response.status_code == 200:
return response.json()

print(f'Got status code {response.status_code}, text:')
print(response.text)
raise Exception('Failed to fetch echidna result')
tries -= 1
if tries:
print('Retrying in 5s')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where the actual sleep is happening. Maybe sleeping for real will help?

time.sleep(5)

raise Exception('Failed to fetch echidna result')

return response.json()


def get_echidna_result(echidna_id):
Expand All @@ -42,15 +50,19 @@ def get_echidna_result(echidna_id):
result = response['results']['status']
print(f'Echidna issue {echidna_id} is {result}.')
print(json.dumps(response, indent=2))
return result == 'success'
if result != 'success':
raise Exception(f'Echidna result: {result}')


def main(argv):
directory = os.getcwd() if len(argv) < 2 else argv[1]
echidna_id = get_echidna_id(directory)
print(f'Got echidna id {echidna_id}.')
time.sleep(5)
if not get_echidna_result(echidna_id):
try:
get_echidna_result(echidna_id)
except Exception as e:
print(f'Echidna failure: {e}')
sys.exit(1)


Expand Down
Loading