#Table creation from connector import DBHandler import sys import timing dbh = DBHandler() table = """CREATE TABLE `{0}` ( `db_ref` varchar(100) NOT NULL, `query_id` varchar(100) NOT NULL, `query_len` int(11) NOT NULL, `hit_id` varchar(400) NOT NULL, `hit_def` varchar(400) NOT NULL, `hit_lenght` int(11) NOT NULL, `e_value` double NOT NULL, `coverage` double NOT NULL, `covovere_value` double NOT NULL, `alig_score` float NOT NULL, `alig_bitscore` float NOT NULL, `alig_identy` float NOT NULL, `gi_id` varchar(3000) NOT NULL, `ref_seq_ac` varchar(1000) NOT NULL, `ref_seq_def` varchar(1000) NOT NULL, `go_ids` varchar(3000) NOT NULL, `go_terms` varchar(12000) NOT NULL, `go_ontology` varchar(100) NOT NULL, `uniprot_ac` varchar(50) NOT NULL, `uniprot_def` varchar(300) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Tabla con los campos definitivos';"""
#name = "headlines.c2_up.clean.ok" #sp = name.split('.') #print sp[0]+'.'+sp[1] import sys from connector import DBHandler import time import os args = sys.argv inputFilename = args[1] script = open(inputFilename, 'r') lines = script.readlines() qlen = len(lines) print 'Lines:' + str(qlen) a = DBHandler() i = 0 for line in lines: i = i + 1 print i, " Lines processed \r", sys.stdout.flush() a.executeSQL(line) print "" print "Finished!" script.close() os.remove(inputFilename)
#name = "headlines.c2_up.clean.ok" #sp = name.split('.') #print sp[0]+'.'+sp[1] import sys from connector import DBHandler import time import os args = sys.argv inputFilename = args[1] script = open(inputFilename,'r') lines = script.readlines(); qlen = len(lines) print 'Lines:'+str(qlen) a = DBHandler() i = 0 for line in lines: i = i + 1 print i," Lines processed \r", sys.stdout.flush() a.executeSQL(line) print "" print "Finished!" script.close() os.remove(inputFilename)
#!/usr/bin/python print 'Locating!' import sys from connector import DBHandler import time import os import smtplib a = DBHandler() def execute(command): os.system(command) while(True): time.sleep(1) result = a.executeSQL("select * from commands where state='new'") for command in result: cmd = command['command'] query = "UPDATE commands SET state='running' WHERE id={0}".format(command['id']) a.executeSQL(query) print "############# NEW COMMAND ############" print "new command: {0} is now running".format(cmd) print "______________________________________" execute(command['command']) query2 = "UPDATE commands SET state='finishd' WHERE id={0}".format(command['id']) a.executeSQL(query2) print "state updated to 'finished'" sender = '*****@*****.**' receivers = [command['email']]