Exemple #1
0
        def normalizeall (self,input,output,rangeb,rangea):# Currently disabled
        #VERIFICAR WHILE DEBIDO A QUE LOS QUIERIES SON < y no <=
            config=Config()
            INCREMENT=config.getCronTime()
            start=rangeb
            end=rangea
            join = [[0 for i in range(7)] for j in range(((end-start)/300)-1)]
            c1=c2=x=0
            start =( start - start%INCREMENT) + INCREMENT # CHANGE TO INCREMENT
            while start <end :
                if c1<len(input) and input[c1][3]==start :
                    join[x][0]=input[c1][0]
                    join[x][2]=input[c1][1]
                    join[x][4]=input[c1][2]
                    c1=c1+1
                else:
                    join[x][0]=0
                    join[x][2]=0
                    join[x][4]=0
                if c2<len(output) and output[c2][3]==start  :
                    join[x][1]=output[c2][0]
                    join[x][3]=output[c2][1]
                    join[x][5]=output[c2][2]
                    c2=c2+1
                else:
                    join[x][1]=0
                    join[x][3]=0
                    join[x][5]=0

                join[x][6]=start
                start=start+INCREMENT
                x=x+1

            t=tuple(tuple(x) for x in join)
            return t
Exemple #2
0
#!/usr/bin/python

import time
import MySQLdb
from Config import Config
import os 

config=Config()
DB_NAME=config.getDBName();
DB_HOST='localhost'
DB_USER=config.getUser();
DB_PASS=config.getPassword();
INCREMENT=config.getCronTime()
LOGSPATH=config.getLogsPath()

db = MySQLdb.connect(user=DB_USER, passwd=DB_PASS, db=DB_NAME, host=DB_HOST)
c = db.cursor()


#check if logs path exists, if not create it

if not os.path.exists(LOGSPATH):
	os.makedirs(LOGSPATH)
 
logs=open(LOGSPATH+'/cleanup_log','a+')

#maxtime=31536000
year=31536000  #year in seconds
maxtime=int(config.getOldesttime())*year