Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit e7544971 authored by vpodpecan's avatar vpodpecan
Browse files

Merge branch 'dev' into miRNA

parents 82a64b93 673b0d26
...@@ -25,3 +25,4 @@ build/ ...@@ -25,3 +25,4 @@ build/
# SQLite # SQLite
/mothra/mothra.db /mothra/mothra.db
/mothra/mothra.db-journal
...@@ -4,7 +4,7 @@ from fabric.colors import * ...@@ -4,7 +4,7 @@ from fabric.colors import *
from fabric.utils import puts, abort from fabric.utils import puts, abort
env.use_ssh_config = True env.use_ssh_config = True
apps_to_migrate = ('workflows',) apps_to_migrate = ('workflows','streams',)
def live(): def live():
""" doloci live server kot aktivni """ """ doloci live server kot aktivni """
...@@ -37,9 +37,20 @@ def deploy(): ...@@ -37,9 +37,20 @@ def deploy():
puts(yellow("[Auto importing packages]")) puts(yellow("[Auto importing packages]"))
run("python manage.py auto_import_packages") run("python manage.py auto_import_packages")
with cd('/srv/django-projects/supervisor'):
puts(yellow("[Restarting the run streams daemon"))
run('supervisorctl restart runstreams')
#puts(yellow("[Compressing]")) #puts(yellow("[Compressing]"))
#run('python manage.py compress') #run('python manage.py compress')
def supervisorstat():
"supervisor statistika na serverju"
with prefix('source /srv/django-envs/mothra/bin/activate'):
with cd('/srv/django-projects/supervisor'):
#run('tail /srv/django-logs/runstreams.stdout.log')
run('supervisorctl status')
def apache_restart(): def apache_restart():
"""restarta apache service """restarta apache service
primer: primer:
......
...@@ -175,21 +175,22 @@ INSTALLED_APPS_DEFAULT = ( ...@@ -175,21 +175,22 @@ INSTALLED_APPS_DEFAULT = (
'django.contrib.humanize', 'django.contrib.humanize',
'orderable_inlines', 'orderable_inlines',
'workflows', 'workflows',
'picklefield' 'picklefield',
'streams',
) )
INSTALLED_APPS_CONCUR = ( INSTALLED_APPS_CONCUR = (
'djcelery', 'djcelery',
) if USE_CONCURRENCY else ( ) if USE_CONCURRENCY else (
'streams',
) )
INSTALLED_APPS_WORKFLOWS_SUB = ( INSTALLED_APPS_WORKFLOWS_SUB = (
'workflows.base', 'workflows.base',
'workflows.latino', #'workflows.latino',
'workflows.decision_support', 'workflows.decision_support',
'workflows.segmine', 'workflows.segmine',
'workflows.subgroup_discovery', #'workflows.subgroup_discovery',
'workflows.nlp', 'workflows.nlp',
'workflows.nl_toolkit', 'workflows.nl_toolkit',
'workflows.ilp', 'workflows.ilp',
...@@ -197,8 +198,9 @@ INSTALLED_APPS_WORKFLOWS_SUB = ( ...@@ -197,8 +198,9 @@ INSTALLED_APPS_WORKFLOWS_SUB = (
'workflows.cforange', 'workflows.cforange',
'workflows.perfeval', 'workflows.perfeval',
'workflows.mysql', 'workflows.mysql',
'workflows.lemmagen', #'workflows.lemmagen',
'workflows.crossbee', #'workflows.crossbee',
'workflows.streaming',
#WORKFLOWS_SUBAPP_PLACEHOLDER #WORKFLOWS_SUBAPP_PLACEHOLDER
) )
......
...@@ -18,6 +18,7 @@ urlpatterns = patterns('', ...@@ -18,6 +18,7 @@ urlpatterns = patterns('',
url(r'^', include('signuplogin.urls')), url(r'^', include('signuplogin.urls')),
url(r'^', include('website.urls')), url(r'^', include('website.urls')),
url(r'^workflows/', include('workflows.urls')), url(r'^workflows/', include('workflows.urls')),
url(r'^streams/', include('streams.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url('^' + LOGIN_URL[1:] + '$', 'django.contrib.auth.views.login', name='login'), url('^' + LOGIN_URL[1:] + '$', 'django.contrib.auth.views.login', name='login'),
......
...@@ -10,4 +10,4 @@ httplib2==0.7.5 ...@@ -10,4 +10,4 @@ httplib2==0.7.5
pyparsing==1.5.6 pyparsing==1.5.6
pydot==1.0.28 pydot==1.0.28
wsgiref==0.1.2 wsgiref==0.1.2
mysql-connector-python==1.0.9 feedparser==5.1.2
\ No newline at end of file
from django.core.management.base import NoArgsCommand
from streams.models import *
class Command(NoArgsCommand):
help = 'see a list of all streams'
option_list = NoArgsCommand.option_list
def handle_noargs(self, **options):
import time
self.stdout.write("Working on streams...")
self.stdout.flush()
while True:
streams = Stream.objects.filter(active=True)
for stream in streams:
#self.stdout.write(u"\nChecking stream "+unicode(stream)+"...\n")
#self.stdout.flush()
#preverimo ce je ze dost casa pretekl
import django
now = django.utils.timezone.now()
delta = now - stream.last_executed
delta_seconds = delta.seconds + delta.days * 86400
if delta_seconds > stream.period:
stream.last_executed = now
stream.save()
self.stdout.write(u"<"+str(now)+">Executing "+unicode(stream)+"...")
self.stdout.flush()
stream.execute()
self.stdout.write("done!\n")
self.stdout.flush()
#print stream.execute()
time.sleep(1)
#self.stdout.write(".")
#self.stdout.flush()
from django.core.management.base import NoArgsCommand
from streams.models import *
class Command(NoArgsCommand):
help = 'check for streams that need to be executed and execute them'
option_list = NoArgsCommand.option_list
def handle_noargs(self, **options):
import time
self.stdout.write("Working on streams...")
self.stdout.flush()
while True:
streams = Stream.objects.filter(active=True)
for stream in streams:
#self.stdout.write(u"\nChecking stream "+unicode(stream)+"...\n")
#self.stdout.flush()
#preverimo ce je ze dost casa pretekl
import django
now = django.utils.timezone.now()
delta = now - stream.last_executed
delta_seconds = delta.seconds + delta.days * 86400
if delta_seconds > stream.period:
stream.last_executed = now
stream.save()
self.stdout.write(u"Executing "+unicode(stream)+"...")
self.stdout.flush()
try:
stream.execute()
except:
import traceback
self.stdout.write("\n ERROR in executing stream:\n")
traceback.print_exc(file=self.stdout)
self.stdout.write("done!\n")
self.stdout.flush()
#print stream.execute()
time.sleep(1)
#self.stdout.write(".")
#self.stdout.flush()
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'StreamWidgetData'
db.create_table('streams_streamwidgetdata', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('stream', self.gf('django.db.models.fields.related.ForeignKey')(related_name='widget_data', to=orm['streams.Stream'])),
('widget', self.gf('django.db.models.fields.related.ForeignKey')(related_name='stream_data', to=orm['workflows.Widget'])),
('value', self.gf('picklefield.fields.PickledObjectField')(null=True)),
))
db.send_create_signal('streams', ['StreamWidgetData'])
# Adding field 'Stream.active'
db.add_column('streams_stream', 'active',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
def backwards(self, orm):
# Deleting model 'StreamWidgetData'
db.delete_table('streams_streamwidgetdata')
# Deleting field 'Stream.active'
db.delete_column('streams_stream', 'active')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'streams.stream': {
'Meta': {'object_name': 'Stream'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_executed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'period': ('django.db.models.fields.IntegerField', [], {'default': '60'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['auth.User']"}),
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['workflows.Workflow']"})
},
'streams.streamwidgetdata': {
'Meta': {'object_name': 'StreamWidgetData'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'stream': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widget_data'", 'to': "orm['streams.Stream']"}),
'value': ('picklefield.fields.PickledObjectField', [], {'null': 'True'}),
'widget': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'stream_data'", 'to': "orm['workflows.Widget']"})
},
'workflows.abstractwidget': {
'Meta': {'ordering': "('order', 'name')", 'object_name': 'AbstractWidget'},
'action': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widgets'", 'to': "orm['workflows.Category']"}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'has_progress_bar': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('workflows.thumbs.ThumbnailField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'interaction_view': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'interactive': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_streaming': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'post_interact_action': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'treeview_image': ('workflows.thumbs.ThumbnailField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'widgets'", 'null': 'True', 'to': "orm['auth.User']"}),
'visualization_view': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'wsdl': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'wsdl_method': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'})
},
'workflows.category': {
'Meta': {'ordering': "('order', 'name')", 'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['workflows.Category']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'categories'", 'null': 'True', 'to': "orm['auth.User']"}),
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'categories'", 'null': 'True', 'to': "orm['workflows.Workflow']"})
},
'workflows.widget': {
'Meta': {'object_name': 'Widget'},
'abstract_widget': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'instances'", 'null': 'True', 'to': "orm['workflows.AbstractWidget']"}),
'error': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interaction_waiting': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'progress': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'running': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'type': ('django.db.models.fields.CharField', [], {'default': "'regular'", 'max_length': '50'}),
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widgets'", 'to': "orm['workflows.Workflow']"}),
'x': ('django.db.models.fields.IntegerField', [], {}),
'y': ('django.db.models.fields.IntegerField', [], {})
},
'workflows.workflow': {
'Meta': {'ordering': "['name']", 'object_name': 'Workflow'},
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'default': "'Untitled workflow'", 'max_length': '200'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'template_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['workflows.Workflow']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'workflows'", 'to': "orm['auth.User']"}),
'widget': ('django.db.models.fields.related.OneToOneField', [], {'blank': 'True', 'related_name': "'workflow_link'", 'unique': 'True', 'null': 'True', 'to': "orm['workflows.Widget']"})
}
}
complete_apps = ['streams']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Stream.workflow'
db.alter_column('streams_stream', 'workflow_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['workflows.Workflow']))
# Adding unique constraint on 'Stream', fields ['workflow']
db.create_unique('streams_stream', ['workflow_id'])
def backwards(self, orm):
# Removing unique constraint on 'Stream', fields ['workflow']
db.delete_unique('streams_stream', ['workflow_id'])
# Changing field 'Stream.workflow'
db.alter_column('streams_stream', 'workflow_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['workflows.Workflow']))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'streams.stream': {
'Meta': {'object_name': 'Stream'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_executed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'period': ('django.db.models.fields.IntegerField', [], {'default': '60'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['auth.User']"}),
'workflow': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'streams'", 'unique': 'True', 'to': "orm['workflows.Workflow']"})
},
'streams.streamwidgetdata': {
'Meta': {'object_name': 'StreamWidgetData'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'stream': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widget_data'", 'to': "orm['streams.Stream']"}),
'value': ('picklefield.fields.PickledObjectField', [], {'null': 'True'}),
'widget': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'stream_data'", 'to': "orm['workflows.Widget']"})
},
'workflows.abstractwidget': {
'Meta': {'ordering': "('order', 'name')", 'object_name': 'AbstractWidget'},
'action': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widgets'", 'to': "orm['workflows.Category']"}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'has_progress_bar': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('workflows.thumbs.ThumbnailField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'interaction_view': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'interactive': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_streaming': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'package': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '150', 'blank': 'True'}),
'post_interact_action': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'static_image': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '250', 'blank': 'True'}),
'streaming_visualization_view': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'treeview_image': ('workflows.thumbs.ThumbnailField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'uid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '250', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'widgets'", 'null': 'True', 'to': "orm['auth.User']"}),
'visualization_view': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
'wsdl': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
'wsdl_method': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'})
},
'workflows.category': {
'Meta': {'ordering': "('order', 'name')", 'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['workflows.Category']"}),
'uid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '250', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'categories'", 'null': 'True', 'to': "orm['auth.User']"}),
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'categories'", 'null': 'True', 'to': "orm['workflows.Workflow']"})
},
'workflows.widget': {
'Meta': {'object_name': 'Widget'},
'abstract_widget': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'instances'", 'null': 'True', 'to': "orm['workflows.AbstractWidget']"}),
'error': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interaction_waiting': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'progress': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'running': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'type': ('django.db.models.fields.CharField', [], {'default': "'regular'", 'max_length': '50'}),
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'widgets'", 'to': "orm['workflows.Workflow']"}),
'x': ('django.db.models.fields.IntegerField', [], {}),
'y': ('django.db.models.fields.IntegerField', [], {})
},
'workflows.workflow': {
'Meta': {'ordering': "['name']", 'object_name': 'Workflow'},
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'default': "'Untitled workflow'", 'max_length': '200'}),
'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'template_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['workflows.Workflow']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'workflows'", 'to': "orm['auth.User']"}),
'widget': ('django.db.models.fields.related.OneToOneField', [], {'blank': 'True', 'related_name': "'workflow_link'", 'unique': 'True', 'null': 'True', 'to': "orm['workflows.Widget']"})
}
}
complete_apps = ['streams']
\ No newline at end of file
from django.db import models from django.db import models
from workflows.models import Workflow from workflows.models import Workflow, Widget
from django.contrib.auth.models import User from django.contrib.auth.models import User
import workflows.library import workflows.library
from picklefield.fields import PickledObjectField
class HaltStream(Exception):
pass
# Create your models here. # Create your models here.
class Stream(models.Model): class Stream(models.Model):
user = models.ForeignKey(User,related_name="streams") user = models.ForeignKey(User,related_name="streams")
workflow = models.ForeignKey(Workflow, related_name="streams") workflow = models.OneToOneField(Workflow, related_name="stream")
last_executed = models.DateTimeField(auto_now_add=True) last_executed = models.DateTimeField(auto_now_add=True)
period = models.IntegerField(default=60) period = models.IntegerField(default=60)
active = models.BooleanField(default=False)
@models.permalink
def get_absolute_url(self):
return ('stream', [str(self.id)])
def stream_visualization_widgets(self):
return self.workflow.widgets.all().exclude(abstract_widget__streaming_visualization_view='')
def reset(self):
self.widget_data.all().delete()
def execute(self,workflow=None,outputs={}): def execute(self,workflow=None,outputs={}):
if workflow is None: if workflow is None:
...@@ -39,12 +55,14 @@ class Stream(models.Model): ...@@ -39,12 +55,14 @@ class Stream(models.Model):
#print for_input #print for_input
finished = [] finished = []
unfinished_list = [] unfinished_list = []
halted = []
loop = True loop = True
while loop: while loop:
for w in unfinished_list: for w in unfinished_list:
# prepare all the inputs for this widget # prepare all the inputs for this widget
input_dict = {} input_dict = {}
output_dict = {} output_dict = {}
finish = True
for i in w.inputs.all(): for i in w.inputs.all():
#gremo pogledat ce obstaja povezava in ce obstaja gremo value prebrat iz outputa #gremo pogledat ce obstaja povezava in ce obstaja gremo value prebrat iz outputa
...@@ -67,10 +85,16 @@ class Stream(models.Model): ...@@ -67,10 +85,16 @@ class Stream(models.Model):
if w.abstract_widget.wsdl != '':