Skip to content

Commit

Permalink
Move settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed May 23, 2024
1 parent 64e3218 commit a8b55db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cvat/apps/engine/cloud_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@
ImageFile.LOAD_TRUNCATED_IMAGES = True

CPU_NUMBER = get_cpu_number()
MAX_THREADS_NUMBER = 4
NUMBER_OF_FILES_PER_THREAD = 1000

def normalize_threads_number(threads_number: Optional[int], number_of_files: int) -> int:
if threads_number is None:
return min(CPU_NUMBER, MAX_THREADS_NUMBER, max(math.ceil(number_of_files / NUMBER_OF_FILES_PER_THREAD), 1))
return min(CPU_NUMBER, settings.CVAT_MAX_THREADS_NUMBER_FOR_DATA_DOWNLOADING, max(math.ceil(number_of_files / settings.CVAT_NUMBER_OF_FILES_PER_THREAD), 1))

return min(threads_number, CPU_NUMBER, MAX_THREADS_NUMBER)
return min(threads_number, CPU_NUMBER, settings.CVAT_MAX_THREADS_NUMBER_FOR_DATA_DOWNLOADING)

class Status(str, Enum):
AVAILABLE = 'AVAILABLE'
Expand Down
3 changes: 3 additions & 0 deletions cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,6 @@ class CVAT_QUEUES(Enum):

from cvat.rq_patching import update_started_job_registry_cleanup
update_started_job_registry_cleanup()

CVAT_MAX_THREADS_NUMBER_FOR_DATA_DOWNLOADING = 4
CVAT_NUMBER_OF_FILES_PER_THREAD = 1000

0 comments on commit a8b55db

Please sign in to comment.