Пример #1
0
def explore_cluster(ID,idconn):
    sql_cluster = "SELECT * FROM worker_node"
    if connect_db.num_rows(idconn,sql_cluster) == 0:
        lista = node_stat.list_nodes(ID)
        for i in lista:
            sql_insert = "INSERT INTO worker_node (node_name) VALUES('"+ i +"')"
            connect_db.executeSQL(idconn,sql_insert)
Пример #2
0
def submit_info(idconn,job_id,table_int,values):    
    
    sql_check = "SELECT * FROM nomad.job WHERE job_id ='" + job_id + "'"
    
    if connect_db.num_rows(idconn,sql_check) == 0:
        #fai un INSERT
        sql_insert = "INSERT INTO job VALUES('"+ job_id +"','"+ values[0] +"','"+ values[2] +"',"+ values[10] +","+ values[8] +",0)"
        sql_insert2 = "INSERT INTO user (job_owner) VALUES('"+ values[1] +"')"
        connect_db.executeSQL(idconn,sql_insert)
        connect_db.executeSQL(idconn,sql_insert2)
        
        sql_id = "SELECT id FROM user WHERE job_owner = '" + str(values[1]) + "'"
        idval = connect_db.executeSQL(idconn,sql_id) 
        
        sql_insert3 = "INSERT INTO sottomissione (job_id,id) VALUES('"+ job_id +"',"+ str(idval[0]) +")"
        connect_db.executeSQL(idconn,sql_insert3)
    else:
        sql_update = ""