Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Bugfix: Continue without doing anything when a collection is ready fo…
Browse files Browse the repository at this point in the history
…r an area not configured

Signed-off-by: Adam.Dybbroe <a000680@c20671.ad.smhi.se>
  • Loading branch information
Adam.Dybbroe committed Jan 16, 2017
1 parent 28751b1 commit 312a4a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions trollduction/helper_functions.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, 2015
# Copyright (c) 2014, 2015, 2017
#
# Author(s):
#
Expand Down Expand Up @@ -454,14 +454,15 @@ def eval_default(expression, default_res=None):

def get_uri_from_message(msg, area_def_names=None):
"""Get URI from posttroll message."""

if msg.type == "file":
uri = msg.data['uri']
elif msg.type == "dataset":
uri = [mda['uri'] for mda in msg.data['dataset']]
elif msg.type == 'collection':
if not msg.data['collection_area_id'] in area_def_names:
LOGGER.info('Collection does not contain data for '
'current areas. Skipping.')
LOGGER.warning('Collection does not contain data for '
'current areas: %s', str(area_def_names))
return None
if 'dataset' in msg.data['collection'][0]:
uri = []
Expand Down
5 changes: 4 additions & 1 deletion trollduction/producer.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2016
# Copyright (c) 2014-2017
#
# Author(s):
#
Expand Down Expand Up @@ -597,6 +597,9 @@ def run(self, product_config, msg):

uri = helper_functions.get_uri_from_message(msg,
self.get_area_def_names())
if not uri:
LOGGER.info("Skipping...")
return

LOGGER.info('New data available: %s', uri)
t1a = time.time()
Expand Down

0 comments on commit 312a4a9

Please sign in to comment.