Skip to content

Commit

Permalink
Merge branch 'master' into feature/api-worker-sep
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma authored May 30, 2024
2 parents 8e898bb + 43c3ad6 commit 7f2adaa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/frontend_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
paths:
- 'frontend/**'
- '.github/workflows/frontend_build_push.yml'
pull_request:
branches: [ master ]
paths:
- 'frontend/**'
- '.github/workflows/frontend_build_push.yml'

permissions:
id-token: write
Expand All @@ -26,7 +21,7 @@ jobs:

strategy:
matrix:
node-version: [ 16 ]
node-version: [ 16.14.2 ]

steps:
- uses: actions/checkout@v4
Expand Down
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
8 changes: 6 additions & 2 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ def create(self, validated_data):
validated_data["created_by"] = user
# create the model instance
instance = Training.objects.create(**validated_data)

celery = Celery()

# run your function here
task = celery.train_model.delay(
dataset_id=instance.model.dataset.id,
Expand All @@ -140,6 +142,8 @@ def create(self, validated_data):
or instance.model.dataset.source_imagery,
freeze_layers=instance.freeze_layers,
)
logging.info("Record saved in queue")

if not instance.source_imagery:
instance.source_imagery = instance.model.dataset.source_imagery
instance.task_id = task.id
Expand Down Expand Up @@ -689,9 +693,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 7f2adaa

Please sign in to comment.