Commit 36f06827 authored by Janez K's avatar Janez K

twitter streams

parent cb543a65
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()
......@@ -11,6 +11,8 @@ class Command(NoArgsCommand):
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()
......@@ -19,8 +21,16 @@ class Command(NoArgsCommand):
if delta_seconds > stream.period:
stream.last_executed = now
stream.save()
#self.stdout.write("-")
#self.stdout.flush()
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(".")
......
......@@ -17,6 +17,12 @@ class Stream(models.Model):
period = models.IntegerField(default=60)
active = models.BooleanField(default=False)
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={}):
if workflow is None:
workflow = self.workflow
......
{% extends "website/base.html" %}
{% load url from future %}
{% block "streamnav" %}
<div class="navbar">
<div class="navbar-inner">
<a class="brand">{{stream}}</a>
<ul class="nav">
{% for w in stream.stream_visualization_widgets %}
<li {% if widget.pk == w.pk %}class="active"{% endif %}><a href="{% url 'stream widget visualization' stream.pk w.pk %}">{{w}}</a></li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
/*!
* Bootstrap Responsive v2.0.0
* Bootstrap Responsive v2.3.2
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
......@@ -7,108 +7,116 @@
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: "";
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@-ms-viewport {
width: device-width;
}
.hidden {
display: none;
visibility: hidden;
}
@media (max-width: 480px) {
.nav-collapse {
-webkit-transform: translate3d(0, 0, 0);
}
.page-header h1 small {
display: block;
line-height: 18px;
}
input[class*="span"],
select[class*="span"],
textarea[class*="span"],
.uneditable-input {
display: block;
width: 100%;
height: 28px;
/* Make inputs at least the height of their button counterpart */
/* Makes inputs behave like true block-level elements */
-webkit-box-sizing: border-box;
/* Older Webkit */
-moz-box-sizing: border-box;
/* Older FF */
-ms-box-sizing: border-box;
/* IE8 */
box-sizing: border-box;
/* CSS3 spec*/
}
.input-prepend input[class*="span"], .input-append input[class*="span"] {
width: auto;
}
input[type="checkbox"], input[type="radio"] {
border: 1px solid #ccc;
}
.form-horizontal .control-group > label {
float: none;
width: auto;
padding-top: 0;
text-align: left;
.visible-phone {
display: none !important;
}
.visible-tablet {
display: none !important;
}
.hidden-desktop {
display: none !important;
}
.visible-desktop {
display: inherit !important;
}
@media (min-width: 768px) and (max-width: 979px) {
.hidden-desktop {
display: inherit !important;
}
.form-horizontal .controls {
margin-left: 0;
.visible-desktop {
display: none !important ;
}
.form-horizontal .control-list {
padding-top: 0;
.visible-tablet {
display: inherit !important;
}
.form-horizontal .form-actions {
padding-left: 10px;
padding-right: 10px;
.hidden-tablet {
display: none !important;
}
.modal {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
width: auto;
margin: 0;
}
@media (max-width: 767px) {
.hidden-desktop {
display: inherit !important;
}
.modal.fade.in {
top: auto;
.visible-desktop {
display: none !important;
}
.modal-header .close {
padding: 10px;
margin: -10px;
.visible-phone {
display: inherit !important;
}
.carousel-caption {
position: static;
.hidden-phone {
display: none !important;
}
}
@media (max-width: 768px) {
.container {
width: auto;
padding: 0 20px;
}
.row-fluid {
width: 100%;
}
.row {
margin-left: 0;
.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: inherit !important;
}
.row > [class*="span"], .row-fluid > [class*="span"] {
float: none;
display: block;
width: auto;
margin: 0;
.hidden-print {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 980px) {
@media (min-width: 1200px) {
.row {
margin-left: -20px;
margin-left: -30px;
*zoom: 1;
}
.row:before, .row:after {
.row:before,
.row:after {
display: table;
line-height: 0;
content: "";
}
.row:after {
......@@ -116,280 +124,349 @@
}
[class*="span"] {
float: left;
margin-left: 20px;
min-height: 1px;
margin-left: 30px;
}
.span1 {
width: 42px;
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 1170px;
}
.span2 {
width: 104px;
.span12 {
width: 1170px;
}
.span3 {
width: 166px;
.span11 {
width: 1070px;
}
.span4 {
width: 228px;
.span10 {
width: 970px;
}
.span5 {
width: 290px;
.span9 {
width: 870px;
}
.span6 {
width: 352px;
.span8 {
width: 770px;
}
.span7 {
width: 414px;
width: 670px;
}
.span8 {
width: 476px;
.span6 {
width: 570px;
}
.span9 {
width: 538px;
.span5 {
width: 470px;
}
.span10 {
width: 600px;
.span4 {
width: 370px;
}
.span11 {
width: 662px;
.span3 {
width: 270px;
}
.span12, .container {
width: 724px;
.span2 {
width: 170px;
}
.offset1 {
margin-left: 82px;
.span1 {
width: 70px;
}
.offset2 {
margin-left: 144px;
.offset12 {
margin-left: 1230px;
}
.offset3 {
margin-left: 206px;
.offset11 {
margin-left: 1130px;
}
.offset4 {
margin-left: 268px;
.offset10 {
margin-left: 1030px;
}
.offset5 {
margin-left: 330px;
.offset9 {
margin-left: 930px;
}
.offset6 {
margin-left: 392px;
.offset8 {
margin-left: 830px;
}
.offset7 {
margin-left: 454px;
margin-left: 730px;
}
.offset8 {
margin-left: 516px;
.offset6 {
margin-left: 630px;
}
.offset9 {
margin-left: 578px;
.offset5 {
margin-left: 530px;
}
.offset10 {
margin-left: 640px;
.offset4 {
margin-left: 430px;
}
.offset11 {
margin-left: 702px;
.offset3 {
margin-left: 330px;
}
.offset2 {
margin-left: 230px;
}
.offset1 {
margin-left: 130px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before, .row-fluid:after {
.row-fluid:before,
.row-fluid:after {
display: table;
line-height: 0;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid > [class*="span"] {
.row-fluid [class*="span"] {
display: block;
float: left;
margin-left: 2.762430939%;
width: 100%;
min-height: 30px;
margin-left: 2.564102564102564%;
*margin-left: 2.5109110747408616%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid > [class*="span"]:first-child {
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span1 {
width: 5.801104972%;
}
.row-fluid .span2 {
width: 14.364640883%;
}
.row-fluid .span3 {
width: 22.928176794%;
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 2.564102564102564%;
}
.row-fluid .span4 {
width: 31.491712705%;
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span5 {
width: 40.055248616%;
.row-fluid .span11 {
width: 91.45299145299145%;
*width: 91.39979996362975%;
}
.row-fluid .span6 {
width: 48.618784527%;
.row-fluid .span10 {
width: 82.90598290598291%;
*width: 82.8527914166212%;
}
.row-fluid .span7 {
width: 57.182320438000005%;
.row-fluid .span9 {
width: 74.35897435897436%;
*width: 74.30578286961266%;
}
.row-fluid .span8 {
width: 65.74585634900001%;
width: 65.81196581196582%;
*width: 65.75877432260411%;
}
.row-fluid .span9 {
width: 74.30939226%;
.row-fluid .span7 {
width: 57.26495726495726%;
*width: 57.21176577559556%;
}
.row-fluid .span10 {
width: 82.87292817100001%;
.row-fluid .span6 {
width: 48.717948717948715%;
*width: 48.664757228587014%;
}
.row-fluid .span11 {