Coverage for /home/pedror/MMS@FCUL/pypka/pypka/concurrency.py : 95%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
ncpus, assign='distributed', merged_results=False): """Start a pool of ncpus processes that execute the targetFunction with the argument iterable_job_arguments_list
Args: targetFunction (function): function to be execute in each process iterable_job_arguments_list (iterable): object enumerating the arguments to be passed to the targetFunction. when using assing='ordered', it can not be a generator ncpus (int): number of processes to launch assign (str): mode to split the jobs among processes Example: iterable_job_arguments_list = [0, 1, 2, 3, 4], ncpus = 2 'distributed' p0 = [0, 2, 4] p1 = [1, 3] 'ordered' p0 = [0, 1, 2] p1 = [3, 4]
Ensures: unpacked_results (list): list of lists containing the returned results from the executed jobs. the order is dependent only on $assign and $ncpus but not on the execution time. """ else:
# Easier debug of the loop but fails afterwards #targetFunction(job)
#print 'exit' #exit()
else:
"""Run sets of simulations of tautomers included in job_list
Args: job_list (list): list of tautomer numbers to be analysed. The use of numbers is needed since class objects can not be pickled and therefore can not be parsed in multiprocessing.
Ensures: results (list) tauname (str): the tautomer name sitenum (int): site id number esolvM (float): the Molecule solvation energy sitpotM (list): the site potential in the Molecule the index corresponds to the atoms in the site esolvS (float): the Site solvation energy sitpotS (list): the site potential in the Site the index corresponds to the atoms in the site """ # each process will run in its own directory #os.system('mkdir -p core_{0}'.format('_'.join([str(i) for i in job_list]))) #os.chdir('core_{0}'.format('_'.join([str(i) for i in job_list])))
# TODO: file name may be too long. needs fix pass
left_time = '~{0}h'.format(int(left / 3600.0)) left_time = '~{0}m'.format(int(left / 60.0)) else:
'Run {2:5} of {3:<10} ' 'Ends in {4} at {5}'.format(tauname, sitenum, config.total_jobs - njobs, config.total_jobs, left_time, end_time, len(config.pb_time)))
"""Run two DelPhi simulations: one for the tautomer and other for the same tautomer when all other sites are neutral.
Args: taut (int): number of the tautomer
Ensures: tauname (str): the tautomer name sitenum (int): site id number esolvM (float): the Molecule solvation energy sitpotM (list): the site potential in the Molecule the index corresponds to the atoms in the site esolvS (float): the Site solvation energy sitpotS (list): the site potential in the Site the index corresponds to the atoms in the site """ # get the tautomer object from the tautomer number # transformation needed due to multiprocessing
# Whole Molecule with zero charge except for the tautomer being evaluated
print 'finished Whole Molecule', taut._name, e_solvationM
# Single Site Tautomer
print 'finished Tautomer', taut._name, e_solvationS
sitpotM, e_solvationS, sitpotS)
"""Run interaction calculations between sites in job_list
Args: job_list (list) interaction_number (int): interaction number to be analysed. The use of numbers is needed since class objects can not be pickled and therefore can not be parsed in multiprocessing.
Ensures: results (list) interaction_energies (str): .dat formatted energy interactions between all tautomers of two sites """
|