Skip to content

Commit

Permalink
Create new variable MAX_IMAGE_FRAMES and the tracking-consumer crashe…
Browse files Browse the repository at this point in the history
…s if input has more frames. (#166)
  • Loading branch information
willgraf committed Apr 2, 2021
1 parent d63d31b commit 9b3edd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redis_consumer/consumers/tracking_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def _load_data(self, redis_hash, subdir, fname):
remaining_hashes = set()
frames = {}

if num_frames > settings.MAX_IMAGE_FRAMES:
raise ValueError('This tiff file has {} frames but the maximum '
'number of allowed frames is {}.'.format(
num_frames, settings.MAX_IMAGE_FRAMES))

self.logger.debug('Got tiffstack shape %s.', tiff_stack.shape)

uid = uuid.uuid4().hex
Expand Down
1 change: 1 addition & 0 deletions redis_consumer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
MAX_RETRY = config('MAX_RETRY', default=5, cast=int)
MAX_IMAGE_HEIGHT = config('MAX_IMAGE_HEIGHT', default=2048, cast=int)
MAX_IMAGE_WIDTH = config('MAX_IMAGE_WIDTH', default=2048, cast=int)
MAX_IMAGE_FRAMES = config('MAX_IMAGE_FRAMES', default=60, cast=int)

# Redis client connection
REDIS_HOST = config('REDIS_HOST', default='redis-master')
Expand Down

0 comments on commit 9b3edd5

Please sign in to comment.