Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed May 27, 2024
1 parent d9b417e commit 471443a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion services/ui_backend_service/api/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ async def read_and_output(cache_client, task, logtype, limit=0, page=1, reverse_

return log_response["content"], log_response["pages"]


async def stream_pages(cache_client, task, logtype, output_raw):
page = 1
while True:
Expand Down Expand Up @@ -301,9 +302,10 @@ async def file_download_response(request, filename, async_line_iterator):
async for lines in async_line_iterator():
await response.write(lines.encode("utf-8"))

await response.write_eof()
await response.write_eof()
return response


class LogException(Exception):
def __init__(self, msg='Failed to read log', id='log-error', traceback_str=None):
self.message = msg
Expand Down
6 changes: 3 additions & 3 deletions services/ui_backend_service/data/cache/get_log_file_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def execute(cls,
if log_hash_changed or result_key not in existing_keys:
def content_iter():
return log_provider.get_log_content(task, logtype)

results[result_key] = json.dumps(
paginated_result(
content_iter,
Expand Down Expand Up @@ -309,9 +309,9 @@ def paginated_result(content_iterator: Callable, page: int = 1, limit: int = 0,
loglines = []
for lineno, item in enumerate(content_iterator()):
_ts, line = item
if limit and lineno>(_offset+limit):
if limit and lineno > (_offset + limit):
break
if _offset and lineno<_offset:
if _offset and lineno < _offset:
continue
loglines.append(line)
loglines = "\n".join(loglines)
Expand Down

0 comments on commit 471443a

Please sign in to comment.