예제 #1
0
파일: run.py 프로젝트: spike1390/treeNet
def find_all_inactiveNode():
    mydb.open()
    # active =1 means it is active
    result = mydb.query_db('select * from node WHERE active=0', one=False)
    mydb.close_db()
    nidList=[]
    if result:
        for nid in result:
            nidList.append(nid['nid'])
    return nidList
예제 #2
0
파일: run.py 프로젝트: spike1390/treeNet
def randomly_inactive_node(seed):
    num=random.randint(0,100)
    if(num<seed):
        mydb.open()
    # active =1 means it is active
        result = mydb.query_db('select * from node WHERE active=1', one=False)
        mydb.close_db()
        nidList=[]
        if result:
            for nid in result:
                nidList.append(nid['nid'])
            inactive_nid=nidList[random.randint(0, len(nidList)-1)]
        # set not whose nid is inactive_nid to inactive status, pass nid and inactive(0)
            change_node_status(inactive_nid, 0)
            app.config['updated'] = True
            print find_all_inactiveNode()