def __init__(self, host, api_key=None, label=None, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) self.host = host self.api_key = api_key self.label = label self.loglevel = loglevel self.wms = self.build_wms()
def main(): app = App() parser = app.make_parser() args = parser.parse_args() logger = a_logger('main', level=args.loglevel, filename=args.logfile) args.func(logger, args) if hasattr(args, 'func') else parser.print_help()
def __init__(self, yaml_file, loglevel='INFO'): self.logger = a_logger(self.__class__.__name__, level=loglevel) if os.path.isfile(yaml_file): self.conf = load_config(yaml_file) else: self.logger.critical('{} not exists'.format(yaml_file)) sys.exit()
def __init__(self, host, user, password, server_host, server_user, loglevel='INFO'): self.host = host self.username = user self.password = password self.server_host = server_host self.server_user = server_user self.log = a_logger(self.__class__.__name__, level=loglevel) MC = import_from("vcfminerclient", "VCFMinerClient", error_msg=NO_VCFMINER_CLIENT_MESSAGE) if not host.startswith(('http://', 'https://')): self.log.warning('Must be provided a wellformed url to the VCFMiner server') self.client = MC(conf=dict(host=self.host, username=self.username, password=self.password, server_host=self.server_host, server_user=self.server_user), logger=self.log) self.is_connected = self.client and self.client.is_authenticate if not self.is_connected: self.log.warning("{} VCFMiner server connection failed".format(host)) else: self.log.info("Connected to {} VCFMiner server".format(host))
def __init__(self, host, user, password, bims_label, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) self.host = host self.user = user self.password = password self.bims_label = bims_label self.loglevel = loglevel self.bims = self._build_bims()
def main(): app = App() parser = app.make_parser() args = parser.parse_args() ensure_dir(os.path.dirname(args.logfile)) logger = a_logger('Main', level=args.loglevel, filename=args.logfile) logger.info('{} started'.format(__appname__.capitalize())) args.func(logger, args) if hasattr(args, 'func') else parser.print_help()
def __init__(self, url, user, password, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) BC = import_from("bikaclient", "BikaClient", error_msg=NO_BIKALIMS_CLIENT_MESSAGE) if not url.startswith(('http://', 'https://')): self.log.warning('Must be provided a wellformed url to the Bika ' 'server') self.client = BC(host=url, username=user, password=password) self.log.info("{}".format(self.client.version)) self.log.info("Connected to {} Bika server".format(url))
def __init__(self, args=None): self.loglevel = args.loglevel self.logfile = args.logfile self.logger = a_logger(self.__class__.__name__, level=self.loglevel, filename=self.logfile) path_from_cli = args.config_file if 'config_file' in vars( args) else None cm = ConfigurationManager(args=args, path_from_cli=path_from_cli) self.conf = cm.get_pipelines_config self.cache_dir = cache_dir
def __init__(self, host, user='******', password='******', browsers_label='', server_host=None, server_user=None, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) self.host = host self.user = user self.password = password self.server_host = server_host self.server_user = server_user self.browsers_label = browsers_label self.loglevel = loglevel self.browsers = self._build_browsers()
def __init__(self, host, user, password, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) self.log.debug('Opening connection to {} OMERO server'.format(host)) KB = import_from("bl.vl.kb", "KnowledgeBase") try: self.kb = KB(driver='omero')(host, user, password) except ImportError, e: self.log.error("{}. Have you forgotten to load the OMERO's " "libraries?".format(e)) sys.exit()
def __init__(self, host, user, password, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) self.log.debug('Opening connection to {} OMERO server'.format( host)) KB = import_from("bl.vl.kb", "KnowledgeBase") try: self.kb = KB(driver='omero')(host, user, password) except ImportError, e: self.log.error("{}. Have you forgotten to load the OMERO's " "libraries?".format(e)) sys.exit()
def main(argv): parser = get_parser() args = parser.parse_args(argv) logger = a_logger('BikaService', level='INFO', host=args.log_host, port=args.log_port) bikaApi = BikaApiRestService(logger) irodsApi = IrodsApiRestService(logger) bikaService = BikaService(bikaApi=bikaApi, irodsApi=irodsApi) logger.info("Starting Service") bikaService.start_service(args.host, args.port, args.log_file, args.pid_file, args.server)
def __init__(self, args=None): self.loglevel = args.loglevel self.logfile = args.logfile self.logger = a_logger(self.__class__.__name__, level=self.loglevel, filename=self.logfile) path_from_cli = args.config_file if 'config_file' in vars( args) else None cm = ConfigurationManager(args=args, path_from_cli=path_from_cli) self.conf = cm.get_pipelines_config self.core_environment_file = cm.get_default_config[ 'core_environment_file'] self.environment_file = cm.get_default_config[ 'project_environment_file'] self.cache_dir = cache_dir ensure_dir(self.cache_dir) self.ask_before_to_refresh = args.ask if 'ask' in vars(args) else False
def __init__(self, args=None, path_from_cli=None, path_from_package='config/config.yaml', config_filename='config.yaml'): def copy_config_file_from_package(appname, src, dst): _from_package = resource_filename(appname, src) copyfile(_from_package, dst) self.loglevel = args.loglevel self.logfile = args.logfile logger = a_logger(self.__class__.__name__, level=self.loglevel, filename=self.logfile) cfg_dir = os.path.join(config_dir) config_file_path = os.path.join(cfg_dir, config_filename) # Create configuration file from default if needed if not path_exists(cfg_dir, logger, force=False): logger.info('Creating config dir {}'.format(cfg_dir)) ensure_dir(cfg_dir) if not path_exists(config_file_path, logger, force=False): logger.info('Copying default config file from {} package ' 'resource'.format(__appname__)) copy_config_file_from_package(__appname__, path_from_package, config_file_path) config_file_paths = [] if path_from_cli and path_exists(path_from_cli, logger, force=False): config_file_paths.append(WeightedPath(path_from_cli, 0)) if path_exists(config_file_path, logger, force=False): config_file_paths.append(WeightedPath(config_file_path, 1)) logger.debug("config file paths: {}".format(config_file_paths)) config_file_path = sorted(config_file_paths)[0].path logger.info('Reading configuration from {}'.format(config_file_path)) c = load_config(config_file_path) self.pipes_conf = c['pipelines'] if 'pipelines' in c else None self.default_conf = c['default_vars'] if 'default_vars' in c else None
def __init__(self): logger = a_logger('app') conf = get_conf(logger, config_file_from_cli=None, profile='celery') celery_conf = conf.get_section('celery') self.broker_url = celery_conf.get('broker_url', 'amqp://*****:*****@localhost:5672') self.result_backend = celery_conf.get('result_backend', 'amqp://*****:*****@localhost:5672') self.task_serializer = celery_conf.get('task_serializer', 'json') self.result_serializer = celery_conf.get('result_serializer', 'json') self.enable_utc = celery_conf.get('enable_utc', False) self.timezone = celery_conf.get('timezone', 'Europe/Rome') self.task_publish_retry = celery_conf.get('task_publish_retry', True) retry_policy = { 'max_retries': 10, 'interval_start': 5, 'interval_step': 5, 'interval_max': 5, } self.task_publish_retry_policy = celery_conf.get( 'task_publish_retry_policy', retry_policy)
def __init__(self): logger = a_logger('app') conf = get_conf(logger, config_file_from_cli=None, profile='celery') celery_conf = conf.get_section('celery') self.broker_url = celery_conf.get('broker_url', 'amqp://*****:*****@localhost:5672') self.result_backend = celery_conf.get( 'result_backend', 'amqp://*****:*****@localhost:5672') self.task_serializer = celery_conf.get('task_serializer', 'json') self.result_serializer = celery_conf.get('result_serializer', 'json') self.enable_utc = celery_conf.get('enable_utc', False) self.timezone = celery_conf.get('timezone', 'Europe/Rome') self.task_publish_retry = celery_conf.get('task_publish_retry', True) retry_policy = { 'max_retries': 10, 'interval_start': 5, 'interval_step': 5, 'interval_max': 5, } self.task_publish_retry_policy = celery_conf.get( 'task_publish_retry_policy', retry_policy)
def __init__(self, galaxy_host, api_key, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel) GI = import_from('bioblend.galaxy.objects', 'GalaxyInstance') self.client = GI(galaxy_host, api_key) self.log.info("Connected to {}".format(galaxy_host))
def __init__(self, loglevel='INFO'): self.log = a_logger(self.__class__.__name__, level=loglevel)
def __init__(self, config, loglevel='INFO', logfile=sys.stdout): self.config = config self.logger = a_logger(self.__class__.__name__, level=loglevel, filename=logfile)