示例#1
0
    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)
示例#2
0
    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)
示例#3
0
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
示例#4
0
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
示例#5
0
    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'
示例#6
0
文件: testbase.py 项目: versat/boinc
 def __init__(self, func, args=[], delay=RESULT_METER_DELAY):
     '''Forks to print a progress meter'''
     self.pid = os.fork()
     if self.pid:
         atexit.register(self.stop)
         return
     # re-open database
     from Boinc import db_base, database
     db_base.dbconnection = None
     database.connect()
     prev_s = None
     while True:
         s = func(*args)
         if s != prev_s:
             verbose_echo(1, s)
             prev_s = s
         time.sleep(delay)
示例#7
0
 def __init__(self, func, args=[], delay=RESULT_METER_DELAY):
     '''Forks to print a progress meter'''
     self.pid = os.fork()
     if self.pid:
         atexit.register(self.stop)
         return
     # re-open database
     from Boinc import db_base, database
     db_base.dbconnection = None
     database.connect()
     prev_s = None
     while True:
         s = apply(func, args)
         if s != prev_s:
             verbose_echo(1, s)
             prev_s = s
         time.sleep(delay)
示例#8
0
    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'
# Merken:
#
# In Linkers.txt müssen die ganzen Linker sein, mit allen ausgetauschten Anfangs und Endsequenzen und auch den verschiedenen Winkelmotiven.






exteinlist = ["RGKCWE", "CG"]
startlist = ["GG", ""]


databasefolder = "./import_files/"

database.connect()
#igemdb.connect()

####Hier kann man einfach hinter glob.glob() ein [:10] setzen, um das erstmal auf wengier laufen zu lassen und zu testen


for folder in glob.glob(databasefolder + "*/")[:1]:
	pdbname = folder[-7:-3]
	pdbfname = pdbname + ".pdb"
	subunit = folder[-2]

	print "folder: %s, pdbname: %s, pdbfname: %s, subunit: %s" % (folder, pdbname, pdbfname, subunit)

	shortpath = return_shortpath(folder + pdbfname, subunit)

	#stage the PDB
	def checkBatchComplete(self, wu):
		batchid = wu.batch
		database.connect()
		wus = database.Workunits.count(batch=batchid)
		finished_wus = database.Workunits.count(batch=batchid, assimilate_state=ASSIMILATE_DONE )
		print "There are still %i unassimilated Workunits for Batch %i" % (wus-finished_wus, batchid)