Skip to content

Commit

Permalink
[Fixes #11357] Fix _get_parallel_uploads_count
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed Aug 9, 2023
1 parent 89ba630 commit ffca2bb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions geonode/upload/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
set_time_dimension,
) # mosaic_delete_first_granule
from geonode.resource.models import ExecutionRequest
from django.db.models import Sum

ogr.UseExceptions()

Expand Down Expand Up @@ -691,9 +692,14 @@ def _get_max_parallel_uploads(self):
return parallelism_limit.max_number

def _get_parallel_uploads_count(self):
return (
ExecutionRequest.objects.filter(user=self.user)
.exclude(status=ExecutionRequest.STATUS_RUNNING)
.exclude(status=ExecutionRequest.STATUS_READY)
.count()
"""
Count the total layers that are part of the running import
"""
return sum(
filter(
None,
ExecutionRequest.objects.filter(
user=self.user, status__in=[ExecutionRequest.STATUS_RUNNING, ExecutionRequest.STATUS_READY]
).values_list("input_params__total_layers", flat=True),
)
)

0 comments on commit ffca2bb

Please sign in to comment.