def _configure(self): """ Configure the Pulsar application. """ self.state = service_states.CONFIGURING misc.make_dir(self.pulsar_home) # Write out app.yml token = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.lowercase + string.digits) for _ in range(25)) app_template = Template(app_yml) app_yml_file = os.path.join(self.pulsar_home, 'app.yml') misc.write_template_file(app_template, {'token': token}, app_yml_file) # Write out server.ini srvr_template = Template(server_ini) server_ini_file = os.path.join(self.pulsar_home, 'server.ini') misc.write_template_file(srvr_template, {'pulsar_port': self.pulsar_port}, server_ini_file) # Write out local_env.sh lcl_template = Template(local_env_sh) lcl_file = os.path.join(self.pulsar_home, 'local_env.sh') misc.write_template_file(lcl_template, {'galaxy_home': '/mnt/galaxy/galaxy-app'}, lcl_file) # Set the owner to 'galaxy' system user attempt_chown_galaxy(self.pulsar_home, recursive=True) if self.supervisor: # Create a supervisor conf file supervisor_conf_file = os.path.join(self.supervisor.conf_dir, '{0}.conf'.format(self.supervisor_prog_name)) template = Template(supervisor_conf) misc.write_template_file(template, None, supervisor_conf_file) else: log.warning("No supervisor service?")
def _configure(self): """ Setup Supervisor for running via CloudMan by creating ``supervisord.conf`` file. """ log.debug("Configuring supervisord") # Create supervisord config file sv_vars = { 'supervisord_pid': self.pid_file, 'sv_port': self.sv_port, 'conf_dir': self.conf_dir, 'supervisord_log': self.log_file } template = conf_manager.load_conf_template(conf_manager.SUPERVISOR_TEMPLATE) misc.write_template_file(template, sv_vars, self.main_conf_file) # Make sure the config dir exists for programs managed by supervisor misc.make_dir(self.conf_dir)
def _configure(self): """ Setup Supervisor for running via CloudMan by creating ``supervisord.conf`` file. """ log.debug("Configuring supervisord") # Create supervisord config file sv_vars = { 'supervisord_pid': self.pid_file, 'sv_port': self.sv_port, 'conf_dir': self.conf_dir, 'supervisord_log': self.log_file } template = conf_manager.load_conf_template( conf_manager.SUPERVISOR_TEMPLATE) misc.write_template_file(template, sv_vars, self.main_conf_file) # Make sure the config dir exists for programs managed by supervisor misc.make_dir(self.conf_dir)
def _update_job_conf(app, num_handlers, plugin_id='slurm'): """ Update Galaxy job_conf.xml. At the moment, only job handlers are set. Number of handlers are added that correspond to ``num_handlers``. """ galaxy_config_dir = app.path_resolver.galaxy_config_dir job_conf_file_path = join(galaxy_config_dir, 'job_conf.xml') log.debug("Updating Galaxy's job conf file {0}".format(job_conf_file_path)) template = conf_manager.load_conf_template( conf_manager.GALAXY_JOB_CONF_TEMPLATE) handler_xml = "" for i in range(num_handlers): handler_xml += ( '\t\t<handler id="handler{0}" tags="handlers" />\n'.format(i)) params = {'cloudman_handlers': handler_xml} misc.write_template_file(template, params, job_conf_file_path)
def _configure(self): """ Setup NodeJS Proxy within CloudMan and Galaxy contexts. This will create a config file for Supervisor while other, Galaxy-specific, requirements are assumed present (https://wiki.galaxyproject.org/Admin/IEs). """ log.debug("Configuring NodeJS Proxy.") template_vars = { 'supervisor_prog_name': self.supervisor_prog_name, 'galaxy_home': self.app.path_resolver.galaxy_home, 'np_port': self.np_port, 'galaxy_user': paths.GALAXY_USER_NAME } if self.supervisor: supervisor_conf_file = os.path.join(self.supervisor.conf_dir, '{0}.conf'.format(self.supervisor_prog_name)) template = Template(supervisor_conf) misc.write_template_file(template, template_vars, supervisor_conf_file) return True return False
def _setup(self): log.debug("Running GalaxyReportsService _setup") # WORKAROUND: The run_reports.sh command refers to a parameter # named --safe-pidfile which is not supported by the uwsgi binary. # Replace it with --pidfile instead. patch_start_command = ("sudo sed -i \"s/--safe-pidfile/--pidfile/g" "\" %s/scripts/common_startup_functions.sh" % self.galaxy_home) misc.run(patch_start_command) # Create default output dir for files file_path = os.path.join(self.app.path_resolver.galaxy_home, "database/files") misc.make_dir(file_path, owner='galaxy') tmp_file_path = os.path.join(self.app.path_resolver.galaxy_home, "database/tmp") misc.make_dir(tmp_file_path, owner='galaxy') # Create the new reports config params = { 'galaxy_db_port': self.app.path_resolver.psql_db_port } template = conf_manager.load_conf_template(conf_manager.GALAXY_REPORTS_TEMPLATE) misc.write_template_file(template, params, self.conf_file) attempt_chown_galaxy(self.conf_file)
def _configure(self): """ Setup NodeJS Proxy within CloudMan and Galaxy contexts. This will create a config file for Supervisor while other, Galaxy-specific, requirements are assumed present (https://wiki.galaxyproject.org/Admin/IEs). """ log.debug("Configuring NodeJS Proxy.") template_vars = { 'supervisor_prog_name': self.supervisor_prog_name, 'galaxy_home': self.app.path_resolver.galaxy_home, 'np_port': self.np_port, 'galaxy_user': paths.GALAXY_USER_NAME } if self.supervisor: supervisor_conf_file = os.path.join( self.supervisor.conf_dir, '{0}.conf'.format(self.supervisor_prog_name)) template = Template(supervisor_conf) misc.write_template_file(template, template_vars, supervisor_conf_file) return True return False
def _configure(self): """ Configure the Pulsar application. """ self.state = service_states.CONFIGURING misc.make_dir(self.pulsar_home) # Write out app.yml token = ''.join( random.SystemRandom().choice(string.ascii_uppercase + string.lowercase + string.digits) for _ in range(25)) app_template = Template(app_yml) app_yml_file = os.path.join(self.pulsar_home, 'app.yml') misc.write_template_file(app_template, {'token': token}, app_yml_file) # Write out server.ini srvr_template = Template(server_ini) server_ini_file = os.path.join(self.pulsar_home, 'server.ini') misc.write_template_file(srvr_template, {'pulsar_port': self.pulsar_port}, server_ini_file) # Write out local_env.sh lcl_template = Template(local_env_sh) lcl_file = os.path.join(self.pulsar_home, 'local_env.sh') misc.write_template_file(lcl_template, {'galaxy_home': '/mnt/galaxy/galaxy-app'}, lcl_file) # Set the owner to 'galaxy' system user attempt_chown_galaxy(self.pulsar_home, recursive=True) if self.supervisor: # Create a supervisor conf file supervisor_conf_file = os.path.join( self.supervisor.conf_dir, '{0}.conf'.format(self.supervisor_prog_name)) template = Template(supervisor_conf) misc.write_template_file(template, None, supervisor_conf_file) else: log.warning("No supervisor service?")