Skip to content

Commit

Permalink
Revert "More robust testrunner validation retry logic (eiffel-communi…
Browse files Browse the repository at this point in the history
…ty#80)"

This reverts commit 0904d92.
  • Loading branch information
andmat900 committed Oct 14, 2024
1 parent edeabc9 commit bea7d89
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
6 changes: 2 additions & 4 deletions python/src/etos_api/library/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ async def authorize(
else:
query[key] = value.strip('"')

if not isinstance(url, str) or not (
url.startswith("http://") or url.startswith("https://")
):
raise ValueError(f"No realm URL found in www-authenticate header: {www_auth_header}")
if not url:
raise ValueError(f"No realm found in www-authenticate header: {www_auth_header}")

async with session.get(url, params=query) as response:
response.raise_for_status()
Expand Down
28 changes: 14 additions & 14 deletions python/src/etos_api/library/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
"""ETOS API suite validator module."""
import logging
import asyncio
<<<<<<< HEAD
import time
=======
import random
>>>>>>> parent of 0904d92 (More robust testrunner validation retry logic (#80))
from typing import List, Union
from uuid import UUID

Expand Down Expand Up @@ -267,24 +271,20 @@ async def validate(self, test_suite_url):
test_runners.add(constraint.value)
docker = Docker()
for test_runner in test_runners:
if await TestRunnerValidationCache.is_test_runner_valid(test_runner):
self.logger.info("Using cached test runner validation result: %s", test_runner)
continue
for attempt in range(5):
if attempt > 0:
span.add_event(f"Test runner validation unsuccessful, retry #{attempt}")
self.logger.warning(
"Test runner %s validation unsuccessful, retry #%d",
test_runner,
attempt,
)
for attempt in range(3):
result = await docker.digest(test_runner)
if result:
# only passed validations shall be cached
await TestRunnerValidationCache.set_timestamp(test_runner, time.time())
break
# Total wait time with 5 attempts: 55 seconds
sleep_time = (attempt + 1) ** 2
await asyncio.sleep(sleep_time)
span.add_event(
f"Test runner validation unsuccessful, retrying {3 - attempt} more times"
)
self.logger.warning(
"Test runner %s validation unsuccessful, retrying %d more times",
test_runner,
3 - attempt,
)
await asyncio.sleep(random.randint(1, 3))

assert result is not None, f"Test runner {test_runner} not found"

0 comments on commit bea7d89

Please sign in to comment.