Skip to content

Commit

Permalink
update hostname in each update_status, and call update_status in each…
Browse files Browse the repository at this point in the history
… status block
  • Loading branch information
willgraf committed May 16, 2019
1 parent fee1631 commit 15a4a44
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions redis_consumer/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def update_status(self, redis_hash, status, data=None):
data = {} if data is None else data
data.update({
'status': status,
'updated_at': self.get_current_timestamp()
'updated_at': self.get_current_timestamp(),
'updated_by': self.hostname,
})
self.redis.hmset(redis_hash, data)

Expand Down Expand Up @@ -636,9 +637,7 @@ def _consume(self, redis_hash):

if hvals.get('status') == 'new':
# download the zip file, upload the contents, and enter into Redis
self.update_status(redis_hash, 'started', {
'identity_started': self.hostname,
})
self.update_status(redis_hash, 'started')

all_hashes = self._upload_archived_images(hvals)
self.logger.info('Uploaded %s child keys for key `%s`. Waiting for'
Expand All @@ -651,6 +650,7 @@ def _consume(self, redis_hash):
})

elif hvals.get('status') == 'waiting':
self.update_status(redis_hash, 'updating_children')
# this key was previously processed by a ZipConsumer
# check to see which child keys have been processed
children = set(hvals.get('children', '').split(key_separator))
Expand Down Expand Up @@ -679,6 +679,7 @@ def _consume(self, redis_hash):
})

elif hvals.get('status') == 'cleanup':
self.update_status(redis_hash, 'finishing')
# clean up children with status `done` and `failed`
children = set(hvals.get('children', '').split(key_separator))
done = set(hvals.get('children:done', '').split(key_separator))
Expand Down

0 comments on commit 15a4a44

Please sign in to comment.