class AlignerSlave(JobSlave): """ See also: Aligner.py, AlignerMaster.py """ def initialize(self, params): """ Initialize AlignerSlave. @param params: dictionary with init parameters @type params: {param:value} """ self.__dict__.update( params ) self.params = params ## Only the PATH must be updated from the master to run properly os.environ["PATH"]=self.params['os.environ']["PATH"] self.errorLog = LogFile( self.ferror, mode='a' ) def reportError(self, msg, d ): """ Report error. @param msg: error message @type msg: str @param d: error data @type d: any """ try: s = '%s on %s, job %r\n' % (msg, os.uname()[1], d) s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' self.errorLog.add( s ) try: print msg except: pass except Exception, why: f = open('ErrorReportError_XRefineSlave','a') f.write( str(why) ) try: f.write( T.lastErrorTrace() ) except: pass f.close()
def go(self, dict): """ Run alignment job. @param dict: dictionary with run parameters @type dict: {param:value} """ d = {} val = None try: T.flushPrint(self.progress_str) for id, val in dict.items(): aligner_log = LogFile('%s/Aligner.log' % val["outFolder"]) d[id] = val aligner_log.add('Slave aligns %s on %s' % (id, os.uname()[1])) a = Aligner(outFolder=val["outFolder"], log=aligner_log) ## For the cross validation if not os.path.exists(val["outFolder"] + TC.F_COFFEE): input_file = val["outFolder"] + VS.F_TCOFFEE alpha_path = self.prepareT_coffee(input_file) a.align_for_modeller_inp( pdbFiles=alpha_path, fasta_templates=val["fastaTemplates"], fasta_sequences=val["fastaSequences"], fasta_target=val["fastaTarget"]) ## For a classic project folder else: a.align_for_modeller_inp( pdbFiles=val["pdbFiles"], fasta_templates=val["fastaTemplates"], fasta_sequences=val["fastaSequences"], fasta_target=val["fastaTarget"]) a.go() except Exception, why: self.reportError('ERROR ' + str(why), val)
def go(self, dict): """ Run alignment job. @param dict: dictionary with run parameters @type dict: {param:value} """ d = {} val = None try: T.flushPrint( self.progress_str ) for id, val in dict.items(): aligner_log = LogFile( '%s/Aligner.log' %val["outFolder"] ) d[id] = val aligner_log.add('Slave aligns %s on %s' % (id,os.uname()[1]) ) a = Aligner( outFolder= val["outFolder"], log=aligner_log) ## For the cross validation if not os.path.exists(val["outFolder"] + TC.F_COFFEE): input_file = val["outFolder"] + VS.F_TCOFFEE alpha_path = self.prepareT_coffee(input_file) a.align_for_modeller_inp( pdbFiles=alpha_path, fasta_templates=val["fastaTemplates"], fasta_sequences=val["fastaSequences"], fasta_target=val["fastaTarget"]) ## For a classic project folder else: a.align_for_modeller_inp(pdbFiles=val["pdbFiles"], fasta_templates=val["fastaTemplates"], fasta_sequences=val["fastaSequences"], fasta_target=val["fastaTarget"]) a.go() except Exception, why: self.reportError( 'ERROR '+str(why), val )
class AlignerSlave(JobSlave): """ See also: Aligner.py, AlignerMaster.py """ def initialize(self, params): """ Initialize AlignerSlave. @param params: dictionary with init parameters @type params: {param:value} """ self.__dict__.update(params) self.params = params ## Only the PATH must be updated from the master to run properly os.environ["PATH"] = self.params['os.environ']["PATH"] self.errorLog = LogFile(self.ferror, mode='a') def reportError(self, msg, d): """ Report error. @param msg: error message @type msg: str @param d: error data @type d: any """ try: s = '%s on %s, job %r\n' % (msg, os.uname()[1], d) s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' self.errorLog.add(s) try: print msg except: pass except Exception, why: f = open('ErrorReportError_XRefineSlave', 'a') f.write(str(why)) try: f.write(T.lastErrorTrace()) except: pass f.close()
class ModelSlave(JobSlave): def initialize(self, params): """ Initialize AlignerSlave. @param params: dictionary with init parameters @type params: {param:value} """ self.__dict__.update( params ) self.params = params self.errorLog = LogFile( self.ferror, mode='a' ) def reportError(self, msg, d ): """ Report error. @param msg: error message @type msg: str @param d: error data @type d: any """ try: s = '%s on %s, job %r\n' % (msg, os.uname()[1], d) s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' self.errorLog.add( s ) try: print msg except: pass except Exception, why: f = open('ErrorReportError_XRefineSlave','a') f.write( str(why) ) try: f.write( T.lastErrorTrace() ) except: pass f.close()
class ModelSlave(JobSlave): def initialize(self, params): """ Initialize AlignerSlave. @param params: dictionary with init parameters @type params: {param:value} """ self.__dict__.update(params) self.params = params self.errorLog = LogFile(self.ferror, mode='a') def reportError(self, msg, d): """ Report error. @param msg: error message @type msg: str @param d: error data @type d: any """ try: s = '%s on %s, job %r\n' % (msg, os.uname()[1], d) s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' self.errorLog.add(s) try: print msg except: pass except Exception, why: f = open('ErrorReportError_XRefineSlave', 'a') f.write(str(why)) try: f.write(T.lastErrorTrace()) except: pass f.close()
class AmberEntropySlave( JobSlave ): """ Collect AmberEntropist jobs from AmberEntropyMaster and return result. """ def initialize(self, params): """ expects:: {'nice':int, 'ferror':str, .. } @param params: initialisation parameters passed from the master @type params: dict """ self.__dict__.update( params ) self.errorLog = LogFile( self.ferror, mode='a' ) def reportError(self, msg, id ): try: try: print msg except: pass msg = 'trouble with ' + msg s = '%s on %s, run %s\n' % (msg, os.uname()[1], id) s += '\Error:' + T.lastError() s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' s += '\n' self.errorLog.add( s ) except Exception, why: f = open('ErrorReportError_AmberEntropySlave','a') f.write( str(type(why)) ) try: f.write( T.lastErrorTrace() ) except: pass f.close()
class AmberEntropySlave( JobSlave ): """ Collect AmberEntropist jobs from AmberEntropyMaster and return result. """ def initialize(self, params): """ expects:: {'nice':int, 'ferror':str, .. } @param params: initialisation parameters passed from the master @type params: dict """ self.__dict__.update( params ) self.errorLog = LogFile( self.ferror, mode='a' ) def reportError(self, msg, id ): try: try: print msg except: pass msg = 'trouble with ' + msg s = '%s on %s, run %s\n' % (msg, os.uname()[1], id) s += '\Error:' + T.lastError() s += '\nErrorTrace:\n' + T.lastErrorTrace() + '\n' s += '\n' self.errorLog.add( s ) except Exception, why: f = open('ErrorReportError_AmberEntropySlave','a') f.write( str(type(why)) ) try: f.write( T.lastErrorTrace() ) except: pass f.close()