def __init__( self, **kwargs ): # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) # Connect up the object model if self.config.database_connection: self.model = galaxy.model.mapping.init( self.config.file_path, self.config.database_connection, create_tables = True ) else: self.model = galaxy.model.mapping.init( self.config.file_path, "sqlite://%s?isolation_level=IMMEDIATE" % self.config.database, create_tables = True ) # Initialize the tools self.toolbox = tools.ToolBox( self.config.tool_config, self.config.tool_path ) # Start the job queue self.job_queue = jobs.JobQueue( self.config.job_queue_workers, self ) self.heartbeat = None # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat() self.heartbeat.start()
def __init__(self, **kwargs): super().__init__() self[BasicApp] = self log.debug("python path is: %s", ", ".join(sys.path)) self.name = "reports" # Read config file and check for errors self.config = config.Configuration(**kwargs) self.config.check() configure_logging(self.config) self.application_stack = application_stack_instance() # Determine the database url if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Setup the database engine and ORM self.model = galaxy.model.mapping.init( self.config.file_path, db_url, self.config.database_engine_options, create_tables=True) if not self.config.database_connection: self.targets_mysql = False else: self.targets_mysql = 'mysql' in self.config.database_connection # Security helper self.security = idencoding.IdEncodingHelper( id_secret=self.config.id_secret) self._register_singleton(idencoding.IdEncodingHelper, self.security) self._register_singleton(SharedModelMapping, self.model) # used for cachebusting -- refactor this into a *SINGLE* UniverseApplication base. self.server_starttime = int(time.time())
def _build_dependency_manager_no_config(kwargs): """Simplified variant of build_dependency_manager from galaxy.tools.deps. The canonical factory method requires a full Galaxy configuration object which we do not have available in this script (an optimization). """ configure_logging(kwargs) root = find_root(kwargs) dependency_resolvers_config_file = find_path( kwargs, "dependency_resolvers_config_file", root) use_dependencies, tool_dependency_dir, use_cached_dependency_manager, tool_dependency_cache_dir, precache_dependencies = \ parse_dependency_options(kwargs, root, dependency_resolvers_config_file) if not use_dependencies: dependency_manager = NullDependencyManager() else: dependency_manager_kwds = { 'default_base_path': tool_dependency_dir, 'conf_file': dependency_resolvers_config_file, 'app_config': kwargs, } if use_cached_dependency_manager: dependency_manager_kwds[ 'tool_dependency_cache_dir'] = tool_dependency_cache_dir dependency_manager = CachedDependencyManager( **dependency_manager_kwds) else: dependency_manager = DependencyManager(**dependency_manager_kwds) return dependency_manager
def _build_dependency_manager_no_config(kwargs): """Simplified variant of build_dependency_manager from galaxy.tools.deps. The canonical factory method requires a full Galaxy configuration object which we do not have available in this script (an optimization). """ configure_logging(kwargs) root = find_root(kwargs) dependency_resolvers_config_file = find_path(kwargs, "dependency_resolvers_config_file", root) use_dependencies, tool_dependency_dir, use_cached_dependency_manager, tool_dependency_cache_dir, precache_dependencies = \ parse_dependency_options(kwargs, root, dependency_resolvers_config_file) if not use_dependencies: dependency_manager = NullDependencyManager() else: dependency_manager_kwds = { 'default_base_path': tool_dependency_dir, 'conf_file': dependency_resolvers_config_file, 'app_config': kwargs, } if use_cached_dependency_manager: dependency_manager_kwds['tool_dependency_cache_dir'] = tool_dependency_cache_dir dependency_manager = CachedDependencyManager(**dependency_manager_kwds) else: dependency_manager = DependencyManager(**dependency_manager_kwds) return dependency_manager
def _run_swarm_manager(kwargs, args): configure_logging(kwargs) global log log = logging.getLogger(__name__) root = find_root(kwargs) swarm_manager_config_file = find_path(kwargs, "swarm_manager_config_file", root) swarm_manager_conf = _parse_swarm_manager_conf(swarm_manager_config_file) try: os.makedirs(os.path.dirname(swarm_manager_conf['pid_file'])) except (IOError, OSError) as exc: if exc.errno != errno.EEXIST: raise log.debug("daemonizing, logs will be written to '%s'", swarm_manager_conf['log_file']) pidfile = daemon.pidfile.PIDLockFile(swarm_manager_conf['pid_file']) with open(swarm_manager_conf['log_file'], 'a') as logfh: try: with daemon.DaemonContext( pidfile=pidfile, stdout=logfh, stderr=logfh, ): _swarm_manager(swarm_manager_conf) except lockfile.AlreadyLocked: log.debug( "attempt to daemonize with swarm manager already running ignored" )
def __init__(self, **kwd): log.debug("python path is: %s", ", ".join(sys.path)) self.name = "tool_shed" # Read the tool_shed.ini configuration file and check for errors. self.config = config.Configuration(**kwd) self.config.check() configure_logging(self.config) self.application_stack = application_stack_instance() # Initialize the Galaxy datatypes registry. self.datatypes_registry = galaxy.datatypes.registry.Registry() self.datatypes_registry.load_datatypes(self.config.root, self.config.datatypes_config) # Initialize the Tool Shed repository_types registry. self.repository_types_registry = tool_shed.repository_types.registry.Registry( ) # Initialize the RepositoryGridFilterManager. self.repository_grid_filter_manager = RepositoryGridFilterManager() # Determine the Tool Shed database connection string. if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Initialize the Tool Shed database and check for appropriate schema version. from galaxy.webapps.tool_shed.model.migrate.check import create_or_verify_database create_or_verify_database(db_url, self.config.database_engine_options) # Set up the Tool Shed database engine and ORM. from galaxy.webapps.tool_shed.model import mapping self.model = mapping.init(self.config.file_path, db_url, self.config.database_engine_options) self.security = idencoding.IdEncodingHelper( id_secret=self.config.id_secret) # initialize the Tool Shed tag handler. self.tag_handler = CommunityTagHandler(self) # Initialize the Tool Shed tool data tables. Never pass a configuration file here # because the Tool Shed should always have an empty dictionary! self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_path) self.genome_builds = GenomeBuilds(self) from galaxy import auth self.auth_manager = auth.AuthManager(self) # Citation manager needed to load tools. from galaxy.managers.citations import CitationsManager self.citations_manager = CitationsManager(self) # The Tool Shed makes no use of a Galaxy toolbox, but this attribute is still required. self.toolbox = tools.ToolBox([], self.config.tool_path, self) # Initialize the Tool Shed security agent. self.security_agent = self.model.security_agent # The Tool Shed makes no use of a quota, but this attribute is still required. self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # Initialize the baseline Tool Shed statistics component. self.shed_counter = self.model.shed_counter # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located. self.hgweb_config_manager = self.model.hgweb_config_manager self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir # Initialize the repository registry. self.repository_registry = tool_shed.repository_registry.Registry(self) # used for cachebusting -- refactor this into a *SINGLE* UniverseApplication base. self.server_starttime = int(time.time()) log.debug("Tool shed hgweb.config file is: %s", self.hgweb_config_manager.hgweb_config)
def __init__(self, **kwd): log.debug("python path is: %s", ", ".join(sys.path)) self.name = "tool_shed" # Read the tool_shed.ini configuration file and check for errors. self.config = config.Configuration(**kwd) self.config.check() configure_logging(self.config) self.application_stack = application_stack_instance() # Initialize the Galaxy datatypes registry. self.datatypes_registry = galaxy.datatypes.registry.Registry() self.datatypes_registry.load_datatypes(self.config.root, self.config.datatypes_config) # Initialize the Tool Shed repository_types registry. self.repository_types_registry = tool_shed.repository_types.registry.Registry() # Initialize the RepositoryGridFilterManager. self.repository_grid_filter_manager = RepositoryGridFilterManager() # Determine the Tool Shed database connection string. if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Initialize the Tool Shed database and check for appropriate schema version. from galaxy.webapps.tool_shed.model.migrate.check import create_or_verify_database create_or_verify_database(db_url, self.config.database_engine_options) # Set up the Tool Shed database engine and ORM. from galaxy.webapps.tool_shed.model import mapping self.model = mapping.init(self.config.file_path, db_url, self.config.database_engine_options) # Initialize the Tool Shed security helper. self.security = security.SecurityHelper(id_secret=self.config.id_secret) # initialize the Tool Shed tag handler. self.tag_handler = CommunityTagManager(self) # Initialize the Tool Shed tool data tables. Never pass a configuration file here # because the Tool Shed should always have an empty dictionary! self.tool_data_tables = galaxy.tools.data.ToolDataTableManager(self.config.tool_data_path) self.genome_builds = GenomeBuilds(self) from galaxy import auth self.auth_manager = auth.AuthManager(self) # Citation manager needed to load tools. from galaxy.managers.citations import CitationsManager self.citations_manager = CitationsManager(self) # The Tool Shed makes no use of a Galaxy toolbox, but this attribute is still required. self.toolbox = tools.ToolBox([], self.config.tool_path, self) # Initialize the Tool Shed security agent. self.security_agent = self.model.security_agent # The Tool Shed makes no use of a quota, but this attribute is still required. self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # TODO: Add OpenID support self.openid_providers = OpenIDProviders() # Initialize the baseline Tool Shed statistics component. self.shed_counter = self.model.shed_counter # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located. self.hgweb_config_manager = self.model.hgweb_config_manager self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir # Initialize the repository registry. self.repository_registry = tool_shed.repository_registry.Registry(self) # used for cachebusting -- refactor this into a *SINGLE* UniverseApplication base. self.server_starttime = int(time.time()) log.debug("Tool shed hgweb.config file is: %s", self.hgweb_config_manager.hgweb_config)
def __init__( self, **kwargs ): print >> sys.stderr, "python path is: " + ", ".join( sys.path ) # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) # Set up datatypes registry self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Determine the database url if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Initialize database / check for appropriate schema version from galaxy.model.migrate.check import create_or_verify_database create_or_verify_database( db_url, self.config.database_engine_options ) # Setup the database engine and ORM from galaxy.model import mapping self.model = mapping.init( self.config.file_path, db_url, self.config.database_engine_options ) # Security helper self.security = security.SecurityHelper( id_secret=self.config.id_secret ) # Initialize the tools self.toolbox = tools.ToolBox( self.config.tool_config, self.config.tool_path, self ) # Load datatype converters self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load datatype indexers self.datatypes_registry.load_datatype_indexers( self.toolbox ) #Load security policy self.security_agent = self.model.security_agent # Heartbeat and memdump for thread / heap profiling self.heartbeat = None self.memdump = None self.memory_usage = None # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat() self.heartbeat.start() # Enable the memdump signal catcher if configured and available if self.config.use_memdump: from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() # Enable memory_usage logging if configured if self.config.log_memory_usage: from galaxy.util import memory_usage self.memory_usage = memory_usage # Start the job queue self.job_manager = jobs.JobManager( self ) # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue # Track Store self.track_store = store.TrackStoreManager( self.config.track_store_path )
def __init__(self, configure_logging=True, **kwargs): super().__init__(**kwargs) self._register_singleton(MinimalManagerApp, self) self.execution_timer_factory = self._register_singleton( ExecutionTimerFactory, ExecutionTimerFactory(self.config)) self.configure_fluent_log() self.application_stack = self._register_singleton( ApplicationStack, application_stack_instance(app=self)) if configure_logging: config.configure_logging(self.config, self.application_stack.facts) # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = self._register_singleton( JobMetrics, JobMetrics(self.config.job_metrics_config_file, app=self)) # Initialize the job management configuration self.job_config = self._register_singleton(jobs.JobConfiguration) # Tag handler self.tag_handler = self._register_singleton(GalaxyTagHandler) self.user_manager = self._register_singleton(UserManager) self._register_singleton(GalaxySessionManager) self.hda_manager = self._register_singleton(HDAManager) self.history_manager = self._register_singleton(HistoryManager) self.job_search = self._register_singleton(JobSearch) self.dataset_collection_manager = self._register_singleton( DatasetCollectionManager) self.workflow_manager = self._register_singleton(WorkflowsManager) self.workflow_contents_manager = self._register_singleton( WorkflowContentsManager) self.library_folder_manager = self._register_singleton(FolderManager) self.library_manager = self._register_singleton(LibraryManager) self.library_datasets_manager = self._register_singleton( LibraryDatasetsManager) self.role_manager = self._register_singleton(RoleManager) self.job_manager = self._register_singleton(JobManager) # ConfiguredFileSources self.file_sources = self._register_singleton( ConfiguredFileSources, ConfiguredFileSources.from_app_config(self.config)) self.vault = self._register_singleton(Vault, VaultFactory.from_app(self)) # We need the datatype registry for running certain tasks that modify HDAs, and to build the registry we need # to setup the installed repositories ... this is not ideal self._configure_tool_config_files() self.installed_repository_manager = self._register_singleton( InstalledRepositoryManager, InstalledRepositoryManager(self)) self._configure_datatypes_registry(self.installed_repository_manager) self._register_singleton(Registry, self.datatypes_registry) galaxy.model.set_datatypes_registry(self.datatypes_registry) self.configure_sentry_client()
def _build_dependency_manager_no_config(kwargs): """Simplified variant of build_dependency_manager from galaxy.tool_util.deps. The canonical factory method requires a full Galaxy configuration object which we do not have available in this script (an optimization). """ configure_logging(kwargs) base, ext = os.path.splitext(kwargs.get('dependency_resolvers_config_file', 'dependency_resolvers_conf.xml')) dependency_resolvers_config_file = find_config_file(base, exts=[ext.lstrip('.')]) # FIXME: default is wrong for installed Galaxy dependency_manager = build_dependency_manager(app_config_dict=kwargs, conf_file=dependency_resolvers_config_file, default_tool_dependency_dir="database/dependencies") return dependency_manager
def __init__(self, fsmon=False, configure_logging=True, **kwargs) -> None: super().__init__() self.haltables = [ ("object store", self._shutdown_object_store), ("database connection", self._shutdown_model), ] self._register_singleton(BasicApp, self) if not log.handlers: # Paste didn't handle it, so we need a temporary basic log # configured. The handler added here gets dumped and replaced with # an appropriately configured logger in configure_logging below. logging.basicConfig(level=logging.DEBUG) log.debug("python path is: %s", ", ".join(sys.path)) self.name = 'galaxy' self.is_webapp = False self.new_installation = False # Read config file and check for errors self.config: Any = self._register_singleton( config.Configuration, config.Configuration(**kwargs)) self.config.check() if configure_logging: config.configure_logging(self.config) self._configure_object_store(fsmon=True) config_file = kwargs.get('global_conf', {}).get('__file__', None) if config_file: log.debug('Using "galaxy.ini" config file: %s', config_file) check_migrate_tools = self.config.check_migrate_tools self._configure_models( check_migrate_databases=self.config.check_migrate_databases, check_migrate_tools=check_migrate_tools, config_file=config_file) # Security helper self._configure_security() self._register_singleton(IdEncodingHelper, self.security) self._register_singleton(SharedModelMapping, self.model) self._register_singleton(GalaxyModelMapping, self.model) self._register_singleton(scoped_session, self.model.context)
def __init__(self, **kwargs): if not log.handlers: # Paste didn't handle it, so we need a temporary basic log # configured. The handler added here gets dumped and replaced with # an appropriately configured logger in configure_logging below. logging.basicConfig(level=logging.DEBUG) log.debug("python path is: %s", ", ".join(sys.path)) self.name = 'galaxy' self.startup_timer = ExecutionTimer() self.new_installation = False # Read config file and check for errors self.config = config.Configuration(**kwargs) self.config.check() config.configure_logging(self.config) self.configure_fluent_log() # A lot of postfork initialization depends on the server name, ensure it is set immediately after forking before other postfork functions self.application_stack = application_stack_instance(app=self) self.application_stack.register_postfork_function( self.application_stack.set_postfork_server_name, self) self.config.reload_sanitize_whitelist( explicit='sanitize_whitelist_file' in kwargs) self.amqp_internal_connection_obj = galaxy.queues.connection_from_config( self.config) # control_worker *can* be initialized with a queue, but here we don't # want to and we'll allow postfork to bind and start it. self.control_worker = GalaxyQueueWorker(self) self._configure_tool_shed_registry() self._configure_object_store(fsmon=True) # Setup the database engine and ORM config_file = kwargs.get('global_conf', {}).get('__file__', None) if config_file: log.debug('Using "galaxy.ini" config file: %s', config_file) check_migrate_tools = self.config.check_migrate_tools self._configure_models( check_migrate_databases=self.config.check_migrate_databases, check_migrate_tools=check_migrate_tools, config_file=config_file) # Manage installed tool shed repositories. self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager( self) self._configure_datatypes_registry(self.installed_repository_manager) galaxy.model.set_datatypes_registry(self.datatypes_registry) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagHandler(self.model.context) self.dataset_collections_service = DatasetCollectionManager(self) self.history_manager = HistoryManager(self) self.dependency_resolvers_view = DependencyResolversView(self) self.test_data_resolver = test_data.TestDataResolver( file_dirs=self.config.tool_test_data_directories) self.library_folder_manager = FolderManager() self.library_manager = LibraryManager() self.dynamic_tool_manager = DynamicToolManager(self) # Tool Data Tables self._configure_tool_data_tables(from_shed_config=False) # Load dbkey / genome build manager self._configure_genome_builds(data_table_name="__dbkeys__", load_old_style=True) # Genomes self.genomes = Genomes(self) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = job_metrics.JobMetrics( self.config.job_metrics_config_file, app=self) # Initialize error report plugins. self.error_reports = ErrorReports(self.config.error_report_file, app=self) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) # Setup a Tool Cache self.tool_cache = ToolCache() self.tool_shed_repository_cache = ToolShedRepositoryCache(self) # Watch various config files for immediate reload self.watchers = ConfigWatchers(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers(self) # Load the update repository manager. self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self) # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications( ) # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications(self) # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters(self.toolbox) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool(self.toolbox) # Load history import/export tools. load_lib_tools(self.toolbox) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache) # Tours registry self.tour_registry = ToursRegistry(self.config.tour_config_dir) # Webhooks registry self.webhooks_registry = WebhooksRegistry(self.config.webhooks_dirs) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.model.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent(self.model) else: self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # Heartbeat for thread profiling self.heartbeat = None from galaxy import auth self.auth_manager = auth.AuthManager(self) # Start the heartbeat process if configured and available (wait until # postfork if using uWSGI) if self.config.use_heartbeat: if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( self.config, period=self.config.heartbeat_interval, fname=self.config.heartbeat_log) self.heartbeat.daemon = True self.application_stack.register_postfork_function( self.heartbeat.start) if self.config.enable_oidc: from galaxy.authnz import managers self.authnz_manager = managers.AuthnzManager( self, self.config.oidc_config, self.config.oidc_backends_config) self.sentry_client = None if self.config.sentry_dsn: def postfork_sentry_client(): import raven self.sentry_client = raven.Client( self.config.sentry_dsn, transport=raven.transport.HTTPTransport) self.application_stack.register_postfork_function( postfork_sentry_client) # Transfer manager client if self.config.get_bool('enable_beta_job_managers', False): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager(self) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager(self) self.application_stack.register_postfork_function( self.job_manager.start) self.proxy_manager = ProxyManager(self.config) from galaxy.workflow import scheduling_manager # Must be initialized after job_config. self.workflow_scheduling_manager = scheduling_manager.WorkflowSchedulingManager( self) # Must be initialized after any component that might make use of stack messaging is configured. Alternatively if # it becomes more commonly needed we could create a prefork function registration method like we do with # postfork functions. self.application_stack.init_late_prefork() self.containers = {} if self.config.enable_beta_containers_interface: self.containers = build_container_interfaces( self.config.containers_config_file, containers_conf=self.config.containers_conf) # Configure handling of signals handlers = {} if self.heartbeat: handlers[signal.SIGUSR1] = self.heartbeat.dump_signal_handler self._configure_signal_handlers(handlers) self.database_heartbeat = DatabaseHeartbeat( application_stack=self.application_stack) self.application_stack.register_postfork_function( self.database_heartbeat.start) # Start web stack message handling self.application_stack.register_postfork_function( self.application_stack.start) self.model.engine.dispose() # Inject url_for for components to more easily optionally depend # on url_for. self.url_for = url_for self.server_starttime = int(time.time()) # used for cachebusting log.info("Galaxy app startup finished %s" % self.startup_timer)
def __init__(self, **kwd) -> None: super().__init__() self[BasicApp] = self log.debug("python path is: %s", ", ".join(sys.path)) self.name = "tool_shed" # will be overwritten when building WSGI app self.is_webapp = False # Read the tool_shed.ini configuration file and check for errors. self.config: Any = config.Configuration(**kwd) self.config.check() configure_logging(self.config) self.application_stack = application_stack_instance() # Initialize the Galaxy datatypes registry. self.datatypes_registry = galaxy.datatypes.registry.Registry() self.datatypes_registry.load_datatypes(self.config.root, self.config.datatypes_config) # Initialize the Tool Shed repository_types registry. self.repository_types_registry = tool_shed.repository_types.registry.Registry( ) # Initialize the RepositoryGridFilterManager. self.repository_grid_filter_manager = RepositoryGridFilterManager() # Determine the Tool Shed database connection string. if self.config.database_connection: db_url = self.config.database_connection else: db_url = f"sqlite:///{self.config.database}?isolation_level=IMMEDIATE" # Initialize the Tool Shed database and check for appropriate schema version. from tool_shed.webapp.model.migrate.check import create_or_verify_database create_or_verify_database(db_url, self.config.database_engine_options) # Set up the Tool Shed database engine and ORM. from tool_shed.webapp.model import mapping model: mapping.ToolShedModelMapping = mapping.init( self.config.file_path, db_url, self.config.database_engine_options) self.model = model self.security = idencoding.IdEncodingHelper( id_secret=self.config.id_secret) self._register_singleton(idencoding.IdEncodingHelper, self.security) self._register_singleton(SharedModelMapping, model) self._register_singleton(mapping.ToolShedModelMapping, model) self._register_singleton(scoped_session, self.model.context) self._register_singleton(UserManager, UserManager) # initialize the Tool Shed tag handler. self.tag_handler = CommunityTagHandler(self) # Initialize the Tool Shed tool data tables. Never pass a configuration file here # because the Tool Shed should always have an empty dictionary! self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_path) self.genome_builds = GenomeBuilds(self) self.auth_manager = self._register_singleton( auth.AuthManager, auth.AuthManager(self.config)) # Citation manager needed to load tools. self.citations_manager = self._register_singleton( CitationsManager, CitationsManager(self)) self.use_tool_dependency_resolution = False # Initialize the Tool Shed security agent. self.security_agent = model.security_agent # The Tool Shed makes no use of a quota, but this attribute is still required. self.quota_agent = self._register_singleton(QuotaAgent, NoQuotaAgent()) # Initialize the baseline Tool Shed statistics component. self.shed_counter = model.shed_counter # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located. self.hgweb_config_manager = hgweb_config_manager self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir # Initialize the repository registry. self.repository_registry = tool_shed.repository_registry.Registry(self) # used for cachebusting -- refactor this into a *SINGLE* UniverseApplication base. self.server_starttime = int(time.time()) log.debug("Tool shed hgweb.config file is: %s", self.hgweb_config_manager.hgweb_config)
def __init__(self, **kwargs): print >> sys.stderr, "python path is: " + ", ".join(sys.path) self.name = 'galaxy' self.new_installation = False # Read config file and check for errors self.config = config.Configuration(**kwargs) self.config.check() config.configure_logging(self.config) self.configure_fluent_log() self._amqp_internal_connection_obj = galaxy.queues.connection_from_config( self.config) self._configure_tool_shed_registry() self._configure_object_store(fsmon=True) # Setup the database engine and ORM config_file = kwargs.get('global_conf', {}).get('__file__', None) if config_file: log.debug('Using "galaxy.ini" config file: %s', config_file) check_migrate_tools = self.config.check_migrate_tools self._configure_models(check_migrate_databases=True, check_migrate_tools=check_migrate_tools, config_file=config_file) # Manage installed tool shed repositories. from tool_shed.galaxy_install import installed_repository_manager self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager( self) self._configure_datatypes_registry(self.installed_repository_manager) galaxy.model.set_datatypes_registry(self.datatypes_registry) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagManager(self) # Dataset Collection Plugins self.dataset_collections_service = DatasetCollectionManager(self) # Tool Data Tables self._configure_tool_data_tables(from_shed_config=False) # Load dbkey / genome build manager self._configure_genome_builds(data_table_name="__dbkeys__", load_old_style=True) # Genomes self.genomes = Genomes(self) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = job_metrics.JobMetrics( self.config.job_metrics_config_file, app=self) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers(self) # Load the update repository manager. self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self) # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications( ) # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications(self) # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters(self.toolbox) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool(self.toolbox) # Load history import/export tools. load_history_imp_exp_tools(self.toolbox) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent(self.model) else: self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # Heartbeat for thread profiling self.heartbeat = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path) self.openid_providers = OpenIDProviders.from_file( self.config.openid_config_file) else: self.openid_providers = OpenIDProviders() # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( fname=self.config.heartbeat_log) self.heartbeat.daemon = True self.heartbeat.start() # Transfer manager client if self.config.get_bool('enable_beta_job_managers', False): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager(self) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager(self) self.job_manager.start() # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue self.proxy_manager = ProxyManager(self.config) # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self) from galaxy.workflow import scheduling_manager # Must be initialized after job_config. self.workflow_scheduling_manager = scheduling_manager.WorkflowSchedulingManager( self) self.model.engine.dispose() self.server_starttime = int(time.time()) # used for cachebusting
def __init__( self, **kwargs ): print >> sys.stderr, "python path is: " + ", ".join( sys.path ) self.new_installation = False # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) # Determine the database url if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Initialize database / check for appropriate schema version. # If this # is a new installation, we'll restrict the tool migration messaging. from galaxy.model.migrate.check import create_or_verify_database create_or_verify_database( db_url, kwargs.get( 'global_conf', {} ).get( '__file__', None ), self.config.database_engine_options, app=self ) # Alert the Galaxy admin to tools that have been moved from the distribution to the tool shed. from galaxy.tool_shed.migrate.check import verify_tools verify_tools( self, db_url, kwargs.get( 'global_conf', {} ).get( '__file__', None ), self.config.database_engine_options ) # Object store manager self.object_store = build_object_store_from_config(self.config) # Setup the database engine and ORM from galaxy.model import mapping self.model = mapping.init( self.config.file_path, db_url, self.config.database_engine_options, database_query_profiling_proxy = self.config.database_query_profiling_proxy, object_store = self.object_store ) # Set up the tool sheds registry if os.path.isfile( self.config.tool_sheds_config ): self.tool_shed_registry = galaxy.tool_shed.tool_shed_registry.Registry( self.config.root, self.config.tool_sheds_config ) else: self.tool_shed_registry = None # Manage installed tool shed repositories. self.installed_repository_manager = galaxy.tool_shed.InstalledRepositoryManager( self ) # Create an empty datatypes registry. self.datatypes_registry = galaxy.datatypes.registry.Registry() # Load proprietary datatypes defined in datatypes_conf.xml files in all installed tool shed repositories. We # load proprietary datatypes before datatypes in the distribution because Galaxy's default sniffers include some # generic sniffers (eg text,xml) which catch anything, so it's impossible for proprietary sniffers to be used. # However, if there is a conflict (2 datatypes with the same extension) between a proprietary datatype and a datatype # in the Galaxy distribution, the datatype in the Galaxy distribution will take precedence. If there is a conflict # between 2 proprietary datatypes, the datatype from the repository that was installed earliest will take precedence. # This will also load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_datatypes() # Load the data types in the Galaxy distribution, which are defined in self.config.datatypes_config. self.datatypes_registry.load_datatypes( self.config.root, self.config.datatypes_config ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Security helper self.security = security.SecurityHelper( id_secret=self.config.id_secret ) # Tag handler self.tag_handler = GalaxyTagHandler() # Tool data tables self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_table_config_path ) # Initialize the tools, making sure the list of tool configs includes the reserved migrated_tools_conf.xml file. tool_configs = self.config.tool_configs if self.config.migrated_tools_config not in tool_configs: tool_configs.append( self.config.migrated_tools_config ) self.toolbox = tools.ToolBox( tool_configs, self.config.tool_path, self ) # Search support for tools self.toolbox_search = galaxy.tools.search.ToolBoxSearch( self.toolbox ) # If enabled, poll respective tool sheds to see if updates are available for any installed tool shed repositories. if self.config.get_bool( 'enable_tool_shed_check', False ): from tool_shed import update_manager self.update_manager = update_manager.UpdateManager( self ) # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications() # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool( self.toolbox ) # Load history import/export tools. load_history_imp_exp_tools( self.toolbox ) # Load genome indexer tool. load_genome_index_tools( self.toolbox ) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent( self.model ) else: self.quota_agent = galaxy.quota.NoQuotaAgent( self.model ) # Heartbeat and memdump for thread / heap profiling self.heartbeat = None self.memdump = None self.memory_usage = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path ) self.openid_providers = OpenIDProviders.from_file( self.config.openid_config ) else: self.openid_providers = OpenIDProviders() # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( fname=self.config.heartbeat_log ) self.heartbeat.start() # Enable the memdump signal catcher if configured and available if self.config.use_memdump: from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() # Transfer manager client if self.config.get_bool( 'enable_beta_job_managers', False ): from jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager( self ) # Start the job manager from jobs import manager self.job_manager = manager.JobManager( self ) # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self )
def __init__(self, **kwargs): print >>sys.stderr, "python path is: " + ", ".join(sys.path) self.name = "galaxy" self.new_installation = False # Read config file and check for errors self.config = config.Configuration(**kwargs) self.config.check() config.configure_logging(self.config) self.configure_fluent_log() # Determine the database url if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Set up the tool sheds registry if os.path.isfile(self.config.tool_sheds_config): self.tool_shed_registry = tool_shed.tool_shed_registry.Registry( self.config.root, self.config.tool_sheds_config ) else: self.tool_shed_registry = None # Initialize database / check for appropriate schema version. # If this # is a new installation, we'll restrict the tool migration messaging. from galaxy.model.migrate.check import create_or_verify_database create_or_verify_database( db_url, kwargs.get("global_conf", {}).get("__file__", None), self.config.database_engine_options, app=self ) # Alert the Galaxy admin to tools that have been moved from the distribution to the tool shed. from tool_shed.galaxy_install.migrate.check import verify_tools verify_tools( self, db_url, kwargs.get("global_conf", {}).get("__file__", None), self.config.database_engine_options ) # Object store manager self.object_store = build_object_store_from_config(self.config, fsmon=True) # Setup the database engine and ORM from galaxy.model import mapping self.model = mapping.init( self.config.file_path, db_url, self.config.database_engine_options, database_query_profiling_proxy=self.config.database_query_profiling_proxy, object_store=self.object_store, trace_logger=self.trace_logger, use_pbkdf2=self.config.get_bool("use_pbkdf2", True), ) # Manage installed tool shed repositories. self.installed_repository_manager = tool_shed.galaxy_install.InstalledRepositoryManager(self) # Create an empty datatypes registry. self.datatypes_registry = galaxy.datatypes.registry.Registry() # Load proprietary datatypes defined in datatypes_conf.xml files in all installed tool shed repositories. We # load proprietary datatypes before datatypes in the distribution because Galaxy's default sniffers include some # generic sniffers (eg text,xml) which catch anything, so it's impossible for proprietary sniffers to be used. # However, if there is a conflict (2 datatypes with the same extension) between a proprietary datatype and a datatype # in the Galaxy distribution, the datatype in the Galaxy distribution will take precedence. If there is a conflict # between 2 proprietary datatypes, the datatype from the repository that was installed earliest will take precedence. self.installed_repository_manager.load_proprietary_datatypes() # Load the data types in the Galaxy distribution, which are defined in self.config.datatypes_config. self.datatypes_registry.load_datatypes(self.config.root, self.config.datatypes_config) galaxy.model.set_datatypes_registry(self.datatypes_registry) # Security helper self.security = security.SecurityHelper(id_secret=self.config.id_secret) # Tag handler self.tag_handler = GalaxyTagHandler() # Genomes self.genomes = Genomes(self) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize tool data tables using the config defined by self.config.tool_data_table_config_path. self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( tool_data_path=self.config.tool_data_path, config_filename=self.config.tool_data_table_config_path ) # Load additional entries defined by self.config.shed_tool_data_table_config into tool data tables. self.tool_data_tables.load_from_config_file( config_filename=self.config.shed_tool_data_table_config, tool_data_path=self.tool_data_tables.tool_data_path, from_shed_config=False, ) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) # Initialize the tools, making sure the list of tool configs includes the reserved migrated_tools_conf.xml file. tool_configs = self.config.tool_configs if self.config.migrated_tools_config not in tool_configs: tool_configs.append(self.config.migrated_tools_config) self.toolbox = tools.ToolBox(tool_configs, self.config.tool_path, self) # Search support for tools self.toolbox_search = galaxy.tools.search.ToolBoxSearch(self.toolbox) # Load Data Manager self.data_managers = DataManagers(self) # If enabled, poll respective tool sheds to see if updates are available for any installed tool shed repositories. if self.config.get_bool("enable_tool_shed_check", False): from tool_shed.galaxy_install import update_manager self.update_manager = update_manager.UpdateManager(self) else: self.update_manager = None # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications() # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters(self.toolbox) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool(self.toolbox) # Load history import/export tools. load_history_imp_exp_tools(self.toolbox) # Load genome indexer tool. load_genome_index_tools(self.toolbox) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = None if self.config.visualizations_config_directory: self.visualizations_registry = VisualizationsRegistry( self.config.root, self.config.visualizations_config_directory ) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent(self.model) else: self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # Heartbeat and memdump for thread / heap profiling self.heartbeat = None self.memdump = None self.memory_usage = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager(self.config.openid_consumer_cache_path) self.openid_providers = OpenIDProviders.from_file(self.config.openid_config) else: self.openid_providers = OpenIDProviders() # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat(fname=self.config.heartbeat_log) self.heartbeat.start() # Enable the memdump signal catcher if configured and available if self.config.use_memdump: from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() # Transfer manager client if self.config.get_bool("enable_beta_job_managers", False): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager(self) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager(self) # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self )
def __init__( self, **kwargs ): if not log.handlers: # Paste didn't handle it, so we need a temporary basic log # configured. The handler added here gets dumped and replaced with # an appropriately configured logger in configure_logging below. logging.basicConfig(level=logging.DEBUG) log.debug( "python path is: %s", ", ".join( sys.path ) ) self.name = 'galaxy' self.new_installation = False # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) self.configure_fluent_log() self.config.reload_sanitize_whitelist(explicit='sanitize_whitelist_file' in kwargs) self.amqp_internal_connection_obj = galaxy.queues.connection_from_config(self.config) # control_worker *can* be initialized with a queue, but here we don't # want to and we'll allow postfork to bind and start it. self.control_worker = GalaxyQueueWorker(self) self._configure_tool_shed_registry() self._configure_object_store( fsmon=True ) # Setup the database engine and ORM config_file = kwargs.get( 'global_conf', {} ).get( '__file__', None ) if config_file: log.debug( 'Using "galaxy.ini" config file: %s', config_file ) check_migrate_tools = self.config.check_migrate_tools self._configure_models( check_migrate_databases=True, check_migrate_tools=check_migrate_tools, config_file=config_file ) # Manage installed tool shed repositories. from tool_shed.galaxy_install import installed_repository_manager self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager( self ) self._configure_datatypes_registry( self.installed_repository_manager ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagManager( self ) # Dataset Collection Plugins self.dataset_collections_service = DatasetCollectionManager(self) # Tool Data Tables self._configure_tool_data_tables( from_shed_config=False ) # Load dbkey / genome build manager self._configure_genome_builds( data_table_name="__dbkeys__", load_old_style=True ) # Genomes self.genomes = Genomes( self ) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = job_metrics.JobMetrics( self.config.job_metrics_config_file, app=self ) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers( self ) # Load the update repository manager. self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self ) # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications( self ) # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool( self.toolbox ) # Load history import/export tools. load_lib_tools( self.toolbox ) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache ) # Tours registry self.tour_registry = ToursRegistry(self.config.tour_config_dir) # Webhooks registry self.webhooks_registry = WebhooksRegistry(self.config.webhooks_dirs) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent( self.model ) else: self.quota_agent = galaxy.quota.NoQuotaAgent( self.model ) # Heartbeat for thread profiling self.heartbeat = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path ) self.openid_providers = OpenIDProviders.from_file( self.config.openid_config_file ) else: self.openid_providers = OpenIDProviders() from galaxy import auth self.auth_manager = auth.AuthManager( self ) # Start the heartbeat process if configured and available (wait until # postfork if using uWSGI) if self.config.use_heartbeat: if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( self.config, period=self.config.heartbeat_interval, fname=self.config.heartbeat_log ) self.heartbeat.daemon = True register_postfork_function(self.heartbeat.start) self.sentry_client = None if self.config.sentry_dsn: def postfork_sentry_client(): import raven self.sentry_client = raven.Client(self.config.sentry_dsn) register_postfork_function(postfork_sentry_client) # Transfer manager client if self.config.get_bool( 'enable_beta_job_managers', False ): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager( self ) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager( self ) self.job_manager.start() # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue self.proxy_manager = ProxyManager( self.config ) # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self ) from galaxy.workflow import scheduling_manager # Must be initialized after job_config. self.workflow_scheduling_manager = scheduling_manager.WorkflowSchedulingManager( self ) # Configure handling of signals handlers = {} if self.heartbeat: handlers[signal.SIGUSR1] = self.heartbeat.dump_signal_handler self._configure_signal_handlers( handlers ) self.model.engine.dispose() self.server_starttime = int(time.time()) # used for cachebusting
def __init__( self, **kwargs ): print >> sys.stderr, "python path is: " + ", ".join( sys.path ) # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) # Set up datatypes registry self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Determine the database url if self.config.database_connection: db_url = self.config.database_connection else: db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database # Initialize database / check for appropriate schema version from galaxy.model.migrate.check import create_or_verify_database create_or_verify_database( db_url, self.config.database_engine_options ) # Setup the database engine and ORM from galaxy.model import mapping self.model = mapping.init( self.config.file_path, db_url, self.config.database_engine_options ) # Security helper self.security = security.SecurityHelper( id_secret=self.config.id_secret ) # Initialize the tools self.toolbox = tools.ToolBox( self.config.tool_config, self.config.tool_path, self ) # Load datatype converters self.datatypes_registry.load_datatype_converters( self.toolbox ) #load external metadata tool self.datatypes_registry.load_external_metadata_tool( self.toolbox ) # Load datatype indexers self.datatypes_registry.load_datatype_indexers( self.toolbox ) #Load security policy self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Heartbeat and memdump for thread / heap profiling self.heartbeat = None self.memdump = None self.memory_usage = None # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat() self.heartbeat.start() # Enable the memdump signal catcher if configured and available if self.config.use_memdump: from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() # Enable memory_usage logging if configured if self.config.log_memory_usage: from galaxy.util import memory_usage self.memory_usage = memory_usage # Start the job queue self.job_manager = jobs.JobManager( self ) # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue # Start the cloud manager self.cloud_manager = cloud.CloudManager( self )
def __init__( self, **kwargs ): print >> sys.stderr, "python path is: " + ", ".join( sys.path ) self.name = 'galaxy' self.new_installation = False # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) self.configure_fluent_log() self._amqp_internal_connection_obj = galaxy.queues.connection_from_config(self.config) self._configure_tool_shed_registry() self._configure_object_store( fsmon=True ) # Setup the database engine and ORM config_file = kwargs.get( 'global_conf', {} ).get( '__file__', None ) if config_file: log.debug( 'Using "galaxy.ini" config file: %s', config_file ) check_migrate_tools = self.config.check_migrate_tools self._configure_models( check_migrate_databases=True, check_migrate_tools=check_migrate_tools, config_file=config_file ) # Manage installed tool shed repositories. from tool_shed.galaxy_install import installed_repository_manager self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager( self ) self._configure_datatypes_registry( self.installed_repository_manager ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagManager( self ) # Dataset Collection Plugins self.dataset_collections_service = DatasetCollectionManager(self) # Tool Data Tables self._configure_tool_data_tables( from_shed_config=False ) # Load dbkey / genome build manager self._configure_genome_builds( data_table_name="__dbkeys__", load_old_style=True ) # Genomes self.genomes = Genomes( self ) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = job_metrics.JobMetrics( self.config.job_metrics_config_file, app=self ) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers( self ) # Load the update repository manager. self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self ) # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications( self ) # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool( self.toolbox ) # Load history import/export tools. load_history_imp_exp_tools( self.toolbox ) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache ) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent( self.model ) else: self.quota_agent = galaxy.quota.NoQuotaAgent( self.model ) # Heartbeat for thread profiling self.heartbeat = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path ) self.openid_providers = OpenIDProviders.from_file( self.config.openid_config_file ) else: self.openid_providers = OpenIDProviders() # Start the heartbeat process if configured and available from galaxy import auth self.auth_manager = auth.AuthManager( self ) if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( fname=self.config.heartbeat_log ) self.heartbeat.daemon = True self.heartbeat.start() # Transfer manager client if self.config.get_bool( 'enable_beta_job_managers', False ): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager( self ) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager( self ) self.job_manager.start() # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue self.proxy_manager = ProxyManager( self.config ) # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self ) from galaxy.workflow import scheduling_manager # Must be initialized after job_config. self.workflow_scheduling_manager = scheduling_manager.WorkflowSchedulingManager( self ) self.model.engine.dispose() self.server_starttime = int(time.time()) # used for cachebusting
def __init__( self, **kwargs ): if not log.handlers: # Paste didn't handle it, so we need a temporary basic log # configured. The handler added here gets dumped and replaced with # an appropriately configured logger in configure_logging below. logging.basicConfig(level=logging.DEBUG) log.debug( "python path is: %s", ", ".join( sys.path ) ) self.name = 'galaxy' self.new_installation = False # Read config file and check for errors self.config = config.Configuration( **kwargs ) self.config.check() config.configure_logging( self.config ) self.configure_fluent_log() self.config.reload_sanitize_whitelist(explicit='sanitize_whitelist_file' in kwargs) self.amqp_internal_connection_obj = galaxy.queues.connection_from_config(self.config) # control_worker *can* be initialized with a queue, but here we don't # want to and we'll allow postfork to bind and start it. self.control_worker = GalaxyQueueWorker(self) self._configure_tool_shed_registry() self._configure_object_store( fsmon=True ) # Setup the database engine and ORM config_file = kwargs.get( 'global_conf', {} ).get( '__file__', None ) if config_file: log.debug( 'Using "galaxy.ini" config file: %s', config_file ) check_migrate_tools = self.config.check_migrate_tools self._configure_models( check_migrate_databases=True, check_migrate_tools=check_migrate_tools, config_file=config_file ) # Manage installed tool shed repositories. from tool_shed.galaxy_install import installed_repository_manager self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager( self ) self._configure_datatypes_registry( self.installed_repository_manager ) galaxy.model.set_datatypes_registry( self.datatypes_registry ) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagManager( self ) # Dataset Collection Plugins self.dataset_collections_service = DatasetCollectionManager(self) # Tool Data Tables self._configure_tool_data_tables( from_shed_config=False ) # Load dbkey / genome build manager self._configure_genome_builds( data_table_name="__dbkeys__", load_old_style=True ) # Genomes self.genomes = Genomes( self ) # Data providers registry. self.data_provider_registry = DataProviderRegistry() # Initialize job metrics manager, needs to be in place before # config so per-destination modifications can be made. self.job_metrics = job_metrics.JobMetrics( self.config.job_metrics_config_file, app=self ) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers( self ) # Load the update repository manager. self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self ) # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications( self ) # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool( self.toolbox ) # Load history import/export tools. load_lib_tools( self.toolbox ) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache ) # Tours registry self.tour_registry = ToursRegistry(self.config.tour_config_dir) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent( self.model ) else: self.quota_agent = galaxy.quota.NoQuotaAgent( self.model ) # Heartbeat for thread profiling self.heartbeat = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path ) self.openid_providers = OpenIDProviders.from_file( self.config.openid_config_file ) else: self.openid_providers = OpenIDProviders() from galaxy import auth self.auth_manager = auth.AuthManager( self ) # Start the heartbeat process if configured and available (wait until # postfork if using uWSGI) if self.config.use_heartbeat: if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat( self.config, period=self.config.heartbeat_interval, fname=self.config.heartbeat_log ) self.heartbeat.daemon = True @postfork def _start(): self.heartbeat.start() if not config.process_is_uwsgi: _start() if self.config.sentry_dsn: import raven self.sentry_client = raven.Client(self.config.sentry_dsn) else: self.sentry_client = None # Transfer manager client if self.config.get_bool( 'enable_beta_job_managers', False ): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager( self ) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager( self ) self.job_manager.start() # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue self.proxy_manager = ProxyManager( self.config ) # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self ) from galaxy.workflow import scheduling_manager # Must be initialized after job_config. self.workflow_scheduling_manager = scheduling_manager.WorkflowSchedulingManager( self ) # Configure handling of signals handlers = {} if self.heartbeat: handlers[signal.SIGUSR1] = self.heartbeat.dump_signal_handler self._configure_signal_handlers( handlers ) self.model.engine.dispose() self.server_starttime = int(time.time()) # used for cachebusting
def __init__(self, **kwargs): print >>sys.stderr, "python path is: " + ", ".join(sys.path) self.name = "galaxy" self.new_installation = False # Read config file and check for errors self.config = config.Configuration(**kwargs) self.config.check() config.configure_logging(self.config) self.configure_fluent_log() self._configure_tool_shed_registry() self._configure_object_store(fsmon=True) # Setup the database engine and ORM config_file = kwargs.get("global_conf", {}).get("__file__", None) self._configure_models(check_migrate_databases=True, check_migrate_tools=True, config_file=config_file) # Manage installed tool shed repositories. from tool_shed.galaxy_install import installed_repository_manager self.installed_repository_manager = installed_repository_manager.InstalledRepositoryManager(self) self._configure_datatypes_registry(self.installed_repository_manager) galaxy.model.set_datatypes_registry(self.datatypes_registry) # Security helper self._configure_security() # Tag handler self.tag_handler = GalaxyTagHandler() # Genomes self.genomes = Genomes(self) # Data providers registry. self.data_provider_registry = DataProviderRegistry() self._configure_tool_data_tables(from_shed_config=False) # Initialize the job management configuration self.job_config = jobs.JobConfiguration(self) self._configure_toolbox() # Load Data Manager self.data_managers = DataManagers(self) # If enabled, poll respective tool sheds to see if updates are available for any installed tool shed repositories. if self.config.get_bool("enable_tool_shed_check", False): from tool_shed.galaxy_install import update_manager self.update_manager = update_manager.UpdateManager(self) else: self.update_manager = None # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml self.datatypes_registry.load_display_applications() # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters(self.toolbox) # Load external metadata tool self.datatypes_registry.load_external_metadata_tool(self.toolbox) # Load history import/export tools. load_history_imp_exp_tools(self.toolbox) # Load genome indexer tool. load_genome_index_tools(self.toolbox) # visualizations registry: associates resources with visualizations, controls how to render self.visualizations_registry = None if self.config.visualization_plugins_directory: self.visualizations_registry = VisualizationsRegistry( self, directories_setting=self.config.visualization_plugins_directory, template_cache_dir=self.config.template_cache, ) # Load security policy. self.security_agent = self.model.security_agent self.host_security_agent = galaxy.security.HostAgent( model=self.security_agent.model, permitted_actions=self.security_agent.permitted_actions ) # Load quota management. if self.config.enable_quotas: self.quota_agent = galaxy.quota.QuotaAgent(self.model) else: self.quota_agent = galaxy.quota.NoQuotaAgent(self.model) # Heartbeat and memdump for thread / heap profiling self.heartbeat = None self.memdump = None self.memory_usage = None # Container for OpenID authentication routines if self.config.enable_openid: from galaxy.web.framework import openid_manager self.openid_manager = openid_manager.OpenIDManager(self.config.openid_consumer_cache_path) self.openid_providers = OpenIDProviders.from_file(self.config.openid_config) else: self.openid_providers = OpenIDProviders() # Start the heartbeat process if configured and available if self.config.use_heartbeat: from galaxy.util import heartbeat if heartbeat.Heartbeat: self.heartbeat = heartbeat.Heartbeat(fname=self.config.heartbeat_log) self.heartbeat.start() # Enable the memdump signal catcher if configured and available if self.config.use_memdump: from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() # Transfer manager client if self.config.get_bool("enable_beta_job_managers", False): from galaxy.jobs import transfer_manager self.transfer_manager = transfer_manager.TransferManager(self) # Start the job manager from galaxy.jobs import manager self.job_manager = manager.JobManager(self) # FIXME: These are exposed directly for backward compatibility self.job_queue = self.job_manager.job_queue self.job_stop_queue = self.job_manager.job_stop_queue # Initialize the external service types self.external_service_types = external_service_types.ExternalServiceTypesCollection( self.config.external_service_type_config_file, self.config.external_service_type_path, self ) self.model.engine.dispose()