Commit 73b1243d authored by Janez K's avatar Janez K

Merge branch 'dev' into streams

parents c22245e8 a0ef382b
......@@ -15,6 +15,9 @@ from mothra.settings import USE_CONCURRENCY
if USE_CONCURRENCY:
from workflows.tasks import runWidgetAsync, runForLoopIteration
class WidgetException(Exception):
pass
class Connection(models.Model):
output = models.ForeignKey("Output",related_name="connections")
input = models.ForeignKey("Input",related_name="connections")
......@@ -428,7 +431,7 @@ class Widget(models.Model):
def run(self,offline):
if not self.ready_to_run():
raise Exception("The prerequisites for running this widget have not been met.")
raise WidgetException("The prerequisites for running this widget have not been met.")
self.running=True
self.save()
if self.type == 'regular' or self.type == 'subprocess':
......@@ -558,7 +561,7 @@ class Widget(models.Model):
def run_post(self,request):
if not self.ready_to_run():
raise Exception("The prerequisites for running this widget have not been met.")
raise WidgetException("The prerequisites for running this widget have not been met.")
self.running=True
self.save()
function_to_call = getattr(workflows.library,self.abstract_widget.post_interact_action)
......
......@@ -850,7 +850,7 @@ def run_widget(request):
for o in w.outputs.all():
o.value=None
o.save()
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+':<pre>'+str(sys.exc_info())+'</pre>'})
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+': '+str(type(e))+' '+str(e)})
return HttpResponse(data,mimetype)
else:
return HttpResponse(status=400)
......@@ -885,11 +885,11 @@ def run_tree(request):
w.finished = False
w.save()
print traceback.format_exc(e)
raise
#raise
for o in w.outputs.all():
o.value=None
o.save()
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+':<pre>'+str(sys.exc_info())+'</pre>'})
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+': '+str(type(e))+' '+str(e)})
return HttpResponse(data,mimetype)
else:
return HttpResponse(status=400)
......@@ -914,12 +914,12 @@ def reset_widget(request):
w.save()
print traceback.format_exc(e)
raise
#raise
for o in w.outputs.all():
o.value=None
o.save()
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to reset widget '+w.name+':<pre>'+str(sys.exc_info())+'</pre>'})
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to reset the widget '+w.name+': '+str(type(e))+' '+str(e)})
return HttpResponse(data,mimetype)
else:
return HttpResponse(status=400)
......@@ -1147,11 +1147,11 @@ def finish_interaction(request):
w.interaction_waiting = False
w.save()
print traceback.format_exc(e)
raise
#raise
for o in w.outputs.all():
o.value=None
o.save()
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+':<pre>'+str(sys.exc_info())+'</pre>','widget_id':w.id})
data = simplejson.dumps({'status':'error','message':'Error occurred when trying to execute widget '+w.name+': '+str(type(e))+' '+str(e)},'widget_id':w.id})
return HttpResponse(data,mimetype)
else:
return HttpResponse(status=400)
......
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