Skip to content
Snippets Groups Projects

Resolve "Endpoint for developer statistics"

Merged Daniel Göbel requested to merge feature/62-endpoint-for-developer-statistics into development
2 files
+ 9
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -145,12 +145,13 @@ class GitRepository(ABC):
Flags if the files exist.
"""
with tracer.start_as_current_span("git_check_files_exists") as span:
span.set_attribute("repository", self.url)
span.set_attributes({"repository": self.url, "files": files})
tasks = [asyncio.ensure_future(self.check_file_exists(file, client=client)) for file in files]
result = await asyncio.gather(*tasks)
if raise_error:
missing_files = [f for f, exist in zip(files, result) if not exist]
if len(missing_files) > 0:
span.set_attribute("missing_files", missing_files)
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"The files {', '.join(missing_files)} are missing in the repo {str(self)}",
@@ -175,7 +176,8 @@ class GitRepository(ABC):
with SpooledTemporaryFile(max_size=512000) as f: # temporary file with 500kB data spooled in memory
await self.download_file(filepath, client=client, file_handle=f)
f.seek(0)
obj.upload_fileobj(f)
with tracer.start_as_current_span("s3_upload_file"):
obj.upload_fileobj(f)
async def download_file_stream(self, filepath: str, client: AsyncClient) -> AsyncIterator[bytes]:
"""
Loading