Skip to content

Commit

Permalink
(enhance)Add env variable for training workspace download limit
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Apr 29, 2024
1 parent c060cfa commit 06d8c8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions backend/aiproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
# Limiter
EPOCHS_LIMIT = env("EPOCHS_LIMIT", default=30)
BATCH_SIZE_LIMIT = env("BATCH_SIZE_LIMIT", default=8)
TRAINING_WORKSPACE_DOWNLOAD_LIMIT = env("TRAINING_WORKSPACE_DOWNLOAD_LIMIT", default=200)


# Application definition
Expand Down
4 changes: 2 additions & 2 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ def get(self, request, lookup_dir):
if os.path.isdir(base_dir)
else os.path.getsize(base_dir)
) / (1024**2)
if size > 200: # if file is greater than 200 mb exit
if size > settings.TRAINING_WORKSPACE_DOWNLOAD_LIMIT: # if file is greater than 200 mb exit
return Response(
{f"Errr: File Size {size} MB Exceed More than 200 MB"}, status=403
{f"Errr: File Size {size} MB Exceed More than {settings.TRAINING_WORKSPACE_DOWNLOAD_LIMIT} MB"}, status=403
)

if os.path.isfile(base_dir):
Expand Down

0 comments on commit 06d8c8d

Please sign in to comment.