"""main routine for Ample testing""" import logging import os import sys from ample.util import exit_util, logging_util from ample.testing import run_tests logger = logging_util.setup_console_logging(level=logging.INFO, formatstr='%(asctime)s - %(name)s - %(levelname)s - %(message)s') ############################################################################# ## Multiprocessing crashes on Windows when running multiple jobs. # Issue recorded # 1) https://docs.python.org/2/library/multiprocessing.html#windows if sys.platform.startswith("win"): msg = """ ***************************************************************************** A bug prevents you from invoking our testing framework via the module loader. Please invoke using the following command: % ccp4-python {0}{1}run_tests.py <command> [<args>] ***************************************************************************** """ msg.format(os.path.dirname(__file__), os.sep) logger.critical(msg) sys.exit(1) ############################################################################# ## On Unix systems we can run as normal try: run_tests.main()
from ample.util import exit_util from ample.util import logging_util from ample.util import mrbump_util from ample.util import options_processor from ample.util import pdb_edit from ample.util import pyrvapi_results from ample.util import reference_manager from ample.util import workers_util from ample.util import version __author__ = "Jens Thomas, Felix Simkovic, Adam Simpkin, Ronan Keegan, and Jaclyn Bibby" __credits__ = "Daniel Rigden, Martyn Winn, and Olga Mayans" __email__ = "*****@*****.**" __version__ = version.__version__ logger = logging_util.setup_console_logging() monitor = None class Ample(object): """Class to generate ensembles from ab inito models (all models must have same sequence) """ def __init__(self): self.amopt = None self.ample_output = None return def main(self, args=None): """Main AMPLE routine.
msg = 'Cannot find ensemble pkl file: {0}'.format(optd['restart_pkl']) exit_util.exit_error(msg) try: optd = ample_util.read_amoptd(optd['restart_pkl']) except Exception as e: msg = "Error unpickling ensemble pkl: {0}".format(e.message) exit_util.exit_error(msg, sys.exc_info()[2]) restart = True else: # We're running purely from command-line arguments amopt = config_util.AMPLEConfigOptions() amopt.populate(optd) optd = amopt.d # Start logging to the console logger = logging_util.setup_console_logging() # Make sure we have models if in standalone mode if not restart and not ('models' in optd and optd['models'] and os.path.exists(optd['models'])): msg = 'AMPLE ensembler requires a -models argument with a file/directory of pdbs' exit_util.exit_error(msg, sys.exc_info()[2]) # Set up the working directory if one doesn't already exist if not ('work_dir' in optd and optd['work_dir']): optd['work_dir'] = os.path.join(os.path.abspath(os.path.curdir), ENSEMBLE_DIRNAME) if not os.path.isdir(optd['work_dir']): try: os.mkdir(optd['work_dir']) except OSError as e: msg = 'Error making ensemble workdir {0} : {1}'.format(optd['work_dir'], e) exit_util.exit_error(msg, sys.exc_info()[2])