Commit c22245e8 authored by Janez K's avatar Janez K

dodal haltstream exception

parent 5fa82106
......@@ -186,10 +186,10 @@ INSTALLED_APPS_CONCUR = (
INSTALLED_APPS_WORKFLOWS_SUB = (
'workflows.base',
'workflows.latino',
#'workflows.latino',
'workflows.decision_support',
'workflows.segmine',
'workflows.subgroup_discovery',
#'workflows.subgroup_discovery',
'workflows.nlp',
'workflows.nl_toolkit',
'workflows.ilp',
......@@ -197,8 +197,8 @@ INSTALLED_APPS_WORKFLOWS_SUB = (
'workflows.cforange',
'workflows.perfeval',
'workflows.mysql',
'workflows.lemmagen',
'workflows.crossbee',
#'workflows.lemmagen',
#'workflows.crossbee',
'workflows.streaming',
#WORKFLOWS_SUBAPP_PLACEHOLDER
)
......
......@@ -5,6 +5,9 @@ import workflows.library
from picklefield.fields import PickledObjectField
class HaltStream(Exception):
pass
# Create your models here.
class Stream(models.Model):
......@@ -79,7 +82,7 @@ class Stream(models.Model):
output_dict = function_to_call(input_dict,w,self)
else:
output_dict = function_to_call(input_dict)
except:
except HaltStream:
halted.append(w)
finish=False
......
......@@ -4,6 +4,10 @@ Streaming widgets librarby
@author: Janez Kranjc <janez.kranjc@ijs.si>
'''
def streaming_twitter(input_dict,widget,stream=None):
output_dict = {}
return output_dict
def streaming_rss_reader(input_dict,widget,stream=None):
import feedparser
from streams.models import StreamWidgetData
......@@ -25,12 +29,13 @@ def streaming_rss_reader(input_dict,widget,stream=None):
feed_length = len(feed['items'])
feed['items'].reverse()
for item in feed['items']:
if item['id'] not in data:
data.append(item['id'])
if item['link'] not in data:
data.append(item['link'])
swd.value = data
swd.save()
output_dict['url'] = item['link']
break
else:
raise Exception("Halting stream.")
from streams.models import HaltStream
raise HaltStream("Halting stream.")
return output_dict
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment