コード例 #1
0
ファイル: sara.py プロジェクト: PlanetHunt/satgen
class SaraThread(threading.Thread):
    """
    Sara threads
    """
    def __init__(self, divider, db_tuple, sara):
        threading.Thread.__init__(self)
        self.divider = divider
        self.db_tuple = db_tuple
        self.sara = sara
        self.handled = False
        
        sara.create_files(db_tuple)

    def run(self):
        self.sara.run_sara()

db = DB("satgen.db")
s = Sara("/opt/DRAMA-2.0/TOOLS/SARA", db, "/home/holger/dev/satgen")

space_objects = db.get_final_state_data()

thread_list = []
for u in space_objects["data"]:
    while(len(thread_list) > 4):
        for t in thread_list:
            if not t.isAlive():
                t.handled = True
        thread_list = [t for t in thread_list if not t.handled]
    thread0 = SaraThread(1, u, s)
    thread0.start()
    thread_list.append(thread0)