from functions import query import time n = query("SELECT * FROM elefants;").rowcount while True: time.sleep(1) try: num = query("SELECT * FROM elefants;").rowcount print "%s elefantes se balanceaban, como veian que no se caian," \ " fueron a llamar a otro elefante, llamado: %d" % (num, n) query("INSERT INTO elefants (name) VALUES ('%d');" % n) except: print "ERROR: El elefante %d se ha caido de la tela" % n n = n + 1
from functions import query query("CREATE TABLE elefants (id serial PRIMARY KEY, name varchar);")
from functions import query import time cluster = "192.168.0.100" nodo1 = "192.168.0.1" nodo2 = "192.168.0.2" n = query("SELECT * FROM elefants;", cluster).rowcount while True: time.sleep(1) try: num1 = query("SELECT * FROM elefants;", nodo1).rowcount except: num1 = 0 try: num2 = query("SELECT * FROM elefants;", nodo2).rowcount except: num2 = 0 print "NODO1 %d -- %d NODO2" % (num1, num2)
def node(request, name): t = functions.query(name) data = functions.paginator(request, t) data["breadcrumb"] = functions.breadcrumb(name) return render(request,'node_view.html', data)
def node_year_month_day(request, name, year, month, day): t = functions.query(name, year, month, day) data = functions.paginator(request, t) data["breadcrumb"] = functions.breadcrumb(name,year,month,day) return render(request,'node_view.html', data)
from functions import query import time n = query("SELECT * FROM elefants;").rowcount print "Hay %s elefantes en la tela" % n
# import functions import functions # initialise program functions.query()