def run(self): """ This function runs the class in a loop unless the one_pass or one_pass_WU_N flags are set. Before execution parse_args() is called, the xml config file is loaded and the SIGINT signal is hooked to the sigint_handler method. """ self.parse_args(sys.argv[1:]) self.config = configxml.default_config().config # retrieve app where name = app.name database.connect() app=database.Apps.find1(name=self.appname) database.close() signal.signal(signal.SIGINT, self.sigint_handler) # do one pass or execute main loop if self.one_pass: self.do_pass(app) else: # main loop while(1): database.connect() workdone = self.do_pass(app) database.close() if not workdone: time.sleep(self.sleep_interval)
def run(self): """ This function runs the class in a loop unless the one_pass or one_pass_WU_N flags are set. Before execution parse_args() is called, the xml config file is loaded and the SIGINT signal is hooked to the sigint_handler method. """ self.parse_args(sys.argv[1:]) self.config = configxml.default_config().config # retrieve app where name = app.name database.connect() app = database.Apps.find1(name=self.appname) database.close() signal.signal(signal.SIGINT, self.sigint_handler) # do one pass or execute main loop if self.one_pass: self.do_pass(app) else: # main loop while 1: database.connect() workdone = self.do_pass(app) database.close() if not workdone: time.sleep(self.sleep_interval)
def user_details(userid): """ Fill user details from BOINC database """ user_line = UserInfo() user_line.id = userid database.connect() user = database.Users.find(id=userid)[0] user_line.name = user.name user_line.email = user.email_addr database.close() return user_line
def run(self): self.parse_args(sys.argv[1:]) self.config = configxml.default_config().config # retrieve app where name = app.name database.connect() database.Apps.find1(name=self.appname) conn = db_base.get_dbconnection() user_count = 0 credit_count = 0 transaction = self._connection.begin() query_cursor = conn.cursor() delete_cursor = conn.cursor() query_cursor.execute('select userid, workunitid from credited_job ') results = query_cursor.fetchall() for result in results: user_count += 1 user_id = result['userid'] area_id = result['workunitid'] area_user = self._connection.execute( select([AREA_USER]).where( and_(AREA_USER.c.userid == user_id, AREA_USER.c.area_id == area_id))).first() if area_user is None: area = self._connection.execute( select([AREA]).where(AREA.c.area_id == area_id)).first() galaxy_id = area['galaxy_id'] if area is None: print 'Area', area_id, 'not found, User', user_id, 'not Credited' else: AREA_USER.insert().values(userid=user_id, area_id=area_id) GALAXY_USER.insert().prefix_with('IGNORE').values( userid=user_id, galaxy_id=galaxy_id) print 'User', user_id, 'Credited for Area', area_id credit_count += 1 delete_cursor.execute("delete from credited_job where userid = " + str(user_id) + " and workunitid = " + str(area_id)) transaction.commit() conn.commit() database.close() self._connection.close() print user_count, 'Users', credit_count, 'Credited'
def run(self): self.parse_args(sys.argv[1:]) self.config = configxml.default_config().config # retrieve app where name = app.name database.connect() database.Apps.find1(name=self.appname) conn = db_base.get_dbconnection() user_count = 0 credit_count = 0 transaction = self._connection.begin() query_cursor = conn.cursor() delete_cursor = conn.cursor() query_cursor.execute('select userid, workunitid from credited_job ') results = query_cursor.fetchall() for result in results: user_count += 1 user_id = result['userid'] area_id = result['workunitid'] area_user = self._connection.execute(select([AREA_USER]).where(and_(AREA_USER.c.userid == user_id, AREA_USER.c.area_id == area_id))).first() if area_user is None: area = self._connection.execute(select([AREA]).where(AREA.c.area_id == area_id)).first() galaxy_id = area['galaxy_id'] if area is None: print 'Area', area_id, 'not found, User', user_id, 'not Credited' else: AREA_USER.insert().values(userid=user_id, area_id=area_id) GALAXY_USER.insert().prefix_with('IGNORE').values(userid=user_id, galaxy_id=galaxy_id) print 'User', user_id, 'Credited for Area', area_id credit_count += 1 delete_cursor.execute("delete from credited_job where userid = " + str(user_id) + " and workunitid = " + str(area_id)) transaction.commit() conn.commit() database.close() self._connection.close() print user_count, 'Users', credit_count, 'Credited'
if not attempts < 8: raise Exception("Mysql", "Unable to get workunit with name: %s" % wuname) #create instructions for extein in exteinlist: for nr in range(1,4): if nr == 3: if not shortpath: for slicing in range(500): uniqueforwu = pdbname + "_" + subunit + "_" + "linker" +"_" + extein + "_" + str(nr) + "_" + str(slicing) +"_"+ str(slicing + 1) f = open(folder +"instructions" + "_" + uniqueforwu + ".csv", "w") f.write(subunit +"," + uniqueforwu + "," + str(nr) + "," + str(slicing) +","+ str(slicing + 1) + "," + extein + "," "0") f.close() subprocess.call(["bin/stage_file", "--gzip", folder + "instructions" + "_" + uniqueforwu + ".csv"]) database.close() subprocess.call(["bin/create_work", "--appname", "linker_generator", "--wu_template", "templates/linker_gen.input-template", "--result_template", "templates/linker_gen.result-template", "--batch", str(jobid), "--wu_name", uniqueforwu , "instructions" + "_" + uniqueforwu + ".csv", pdbfname]) database.connect() setWuByName(uniqueforwu, igemdb.INIT) else: uniqueforwu = pdbname + "_" + subunit + "_" + "linker" +"_" + extein + "_" + str(nr) + "_" + "shortpath" f = open(folder +"instructions" + "_" + uniqueforwu + ".csv", "w") f.write(subunit +"," + uniqueforwu + "," + str(nr) + ",0,300" + "," + extein + "," + "1") f.close() subprocess.call(["bin/stage_file", "--gzip", folder + "instructions" + "_" + uniqueforwu + ".csv"]) database.close() subprocess.call(["bin/create_work", "--appname", "linker_generator", "--wu_template", "templates/linker_gen.input-template", "--result_template", "templates/linker_gen.result-template", "--batch", str(jobid),