Skip to content

Commit

Permalink
rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiucco committed Aug 26, 2024
1 parent 2837b64 commit 54716ed
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions fractal_server/app/routes/admin/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ....config import get_settings
from ....syringe import Inject
from ....utils import get_timestamp
from ....zip_tools import _zip_folder_to_byte_stream
from ....zip_tools import _zip_folder_to_byte_stream_iterator
from ...db import AsyncSession
from ...db import get_async_db
from ...models.security import UserOAuth as User
Expand Down Expand Up @@ -388,7 +388,7 @@ async def download_job_logs(
PREFIX_ZIP = Path(job.working_dir).name
zip_filename = f"{PREFIX_ZIP}_archive.zip"
return StreamingResponse(
_zip_folder_to_byte_stream(folder=job.working_dir),
_zip_folder_to_byte_stream_iterator(folder=job.working_dir),
media_type="application/x-zip-compressed",
headers={"Content-Disposition": f"attachment;filename={zip_filename}"},
)
4 changes: 2 additions & 2 deletions fractal_server/app/routes/admin/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ....config import get_settings
from ....syringe import Inject
from ....utils import get_timestamp
from ....zip_tools import _zip_folder_to_byte_stream
from ....zip_tools import _zip_folder_to_byte_stream_iterator
from ...db import AsyncSession
from ...db import get_async_db
from ...models.security import UserOAuth as User
Expand Down Expand Up @@ -275,7 +275,7 @@ async def download_job_logs(
PREFIX_ZIP = Path(job.working_dir).name
zip_filename = f"{PREFIX_ZIP}_archive.zip"
return StreamingResponse(
_zip_folder_to_byte_stream(folder=job.working_dir),
_zip_folder_to_byte_stream_iterator(folder=job.working_dir),
media_type="application/x-zip-compressed",
headers={"Content-Disposition": f"attachment;filename={zip_filename}"},
)
Expand Down
4 changes: 2 additions & 2 deletions fractal_server/app/routes/api/v1/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fastapi.responses import StreamingResponse
from sqlmodel import select

from .....zip_tools import _zip_folder_to_byte_stream
from .....zip_tools import _zip_folder_to_byte_stream_iterator
from ....db import AsyncSession
from ....db import get_async_db
from ....models.v1 import ApplyWorkflow
Expand Down Expand Up @@ -129,7 +129,7 @@ async def download_job_logs(
PREFIX_ZIP = Path(job.working_dir).name
zip_filename = f"{PREFIX_ZIP}_archive.zip"
return StreamingResponse(
_zip_folder_to_byte_stream(folder=job.working_dir),
_zip_folder_to_byte_stream_iterator(folder=job.working_dir),
media_type="application/x-zip-compressed",
headers={"Content-Disposition": f"attachment;filename={zip_filename}"},
)
Expand Down
4 changes: 2 additions & 2 deletions fractal_server/app/routes/api/v2/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fastapi.responses import StreamingResponse
from sqlmodel import select

from .....zip_tools import _zip_folder_to_byte_stream
from .....zip_tools import _zip_folder_to_byte_stream_iterator
from ....db import AsyncSession
from ....db import get_async_db
from ....models.v2 import JobV2
Expand Down Expand Up @@ -128,7 +128,7 @@ async def download_job_logs(
job = output["job"]
zip_name = f"{job.working_dir.split('/')[-1]}.zip"
return StreamingResponse(
_zip_folder_to_byte_stream(folder=job.working_dir),
_zip_folder_to_byte_stream_iterator(folder=job.working_dir),
media_type="application/x-zip-compressed",
headers={"Content-Disposition": f"attachment;filename={zip_name}"},
)
Expand Down
4 changes: 2 additions & 2 deletions fractal_server/zip_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def _create_zip(folder: str, output: T) -> T:
return output


def _zip_folder_to_byte_stream(*, folder: str) -> Iterator:
def _zip_folder_to_byte_stream_iterator(*, folder: str) -> Iterator:
"""
Get byte stream with the zipped log folder of a job.
Returns byte stream with the zipped log folder of a job.