commit/galaxy-central: natefoo: Pass the config file name to set_metadata.py rather than relying on a hardcoded value.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/d0e5fa20e491/ changeset: d0e5fa20e491 user: natefoo date: 2012-02-08 17:12:10 summary: Pass the config file name to set_metadata.py rather than relying on a hardcoded value. affected #: 5 files diff -r c9bdeba75bd18157ea4bf8e64d7278f6c8891eea -r d0e5fa20e4917aac9d058413dcf07b06f0dfec92 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -172,8 +172,10 @@ # Parse global_conf and save the parser global_conf = kwargs.get( 'global_conf', None ) global_conf_parser = ConfigParser.ConfigParser() + self.config_file = None self.global_conf_parser = global_conf_parser if global_conf and "__file__" in global_conf: + self.config_file = global_conf['__file__'] global_conf_parser.read(global_conf['__file__']) # Heartbeat log file name override if global_conf is not None: diff -r c9bdeba75bd18157ea4bf8e64d7278f6c8891eea -r d0e5fa20e4917aac9d058413dcf07b06f0dfec92 lib/galaxy/datatypes/metadata.py --- a/lib/galaxy/datatypes/metadata.py +++ b/lib/galaxy/datatypes/metadata.py @@ -529,7 +529,7 @@ # need to make different keys for them, since ids can overlap return "%s_%d" % ( dataset.__class__.__name__, dataset.id ) def setup_external_metadata( self, datasets, sa_session, exec_dir=None, tmp_dir=None, dataset_files_path=None, - output_fnames=None, config_root=None, datatypes_config=None, job_metadata=None, kwds={} ): + output_fnames=None, config_root=None, config_file=None, datatypes_config=None, job_metadata=None, kwds={} ): #fill in metadata_files_dict and return the command with args required to set metadata def __metadata_files_list_to_cmd_line( metadata_files ): def __get_filename_override(): @@ -604,7 +604,7 @@ sa_session.flush() metadata_files_list.append( metadata_files ) #return command required to build - return "%s %s %s %s %s %s %s" % ( os.path.join( exec_dir, 'set_metadata.sh' ), dataset_files_path, tmp_dir, config_root, datatypes_config, job_metadata, " ".join( map( __metadata_files_list_to_cmd_line, metadata_files_list ) ) ) + return "%s %s %s %s %s %s %s %s" % ( os.path.join( exec_dir, 'set_metadata.sh' ), dataset_files_path, tmp_dir, config_root, config_file, datatypes_config, job_metadata, " ".join( map( __metadata_files_list_to_cmd_line, metadata_files_list ) ) ) def external_metadata_set_successfully( self, dataset, sa_session ): metadata_files = self.get_output_filenames_by_dataset( dataset, sa_session ) diff -r c9bdeba75bd18157ea4bf8e64d7278f6c8891eea -r d0e5fa20e4917aac9d058413dcf07b06f0dfec92 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -863,7 +863,7 @@ sizes.append( ( outfile, 0 ) ) return sizes - def setup_external_metadata( self, exec_dir = None, tmp_dir = None, dataset_files_path = None, config_root = None, datatypes_config = None, set_extension = True, **kwds ): + def setup_external_metadata( self, exec_dir=None, tmp_dir=None, dataset_files_path=None, config_root=None, config_file=None, datatypes_config=None, set_extension=True, **kwds ): # extension could still be 'auto' if this is the upload tool. job = self.get_job() if set_extension: @@ -879,6 +879,8 @@ dataset_files_path = self.app.model.Dataset.file_path if config_root is None: config_root = self.app.config.root + if config_file is None: + config_file = self.app.config.config_file if datatypes_config is None: datatypes_config = self.app.datatypes_registry.integrated_datatypes_configs return self.external_output_metadata.setup_external_metadata( [ output_dataset_assoc.dataset for output_dataset_assoc in job.output_datasets ], @@ -887,6 +889,7 @@ tmp_dir = tmp_dir, dataset_files_path = dataset_files_path, config_root = config_root, + config_file = config_file, datatypes_config = datatypes_config, job_metadata = os.path.join( self.working_directory, TOOL_PROVIDED_JOB_METADATA_FILE ), **kwds ) @@ -1165,7 +1168,7 @@ sizes.append( ( outfile, 0 ) ) return sizes - def setup_external_metadata( self, exec_dir = None, tmp_dir = None, dataset_files_path = None, config_root = None, datatypes_config = None, set_extension = True, **kwds ): + def setup_external_metadata( self, exec_dir=None, tmp_dir=None, dataset_files_path=None, config_root=None, config_file=None, datatypes_config=None, set_extension=True, **kwds ): # There is no metadata setting for tasks. This is handled after the merge, at the job level. return "" diff -r c9bdeba75bd18157ea4bf8e64d7278f6c8891eea -r d0e5fa20e4917aac9d058413dcf07b06f0dfec92 lib/galaxy/tools/actions/metadata.py --- a/lib/galaxy/tools/actions/metadata.py +++ b/lib/galaxy/tools/actions/metadata.py @@ -50,7 +50,8 @@ tmp_dir = trans.app.config.new_file_path, dataset_files_path = trans.app.model.Dataset.file_path, output_fnames = None, - config_root = None, + config_root = trans.app.config.root, + config_file = trans.app.config.config_file, datatypes_config = trans.app.datatypes_registry.integrated_datatypes_configs, job_metadata = None, kwds = { 'overwrite' : overwrite } ) diff -r c9bdeba75bd18157ea4bf8e64d7278f6c8891eea -r d0e5fa20e4917aac9d058413dcf07b06f0dfec92 scripts/set_metadata.py --- a/scripts/set_metadata.py +++ b/scripts/set_metadata.py @@ -36,12 +36,16 @@ tmp_dir = sys.argv.pop( 1 ) galaxy.model.Dataset.file_path = file_path galaxy.datatypes.metadata.MetadataTempFile.tmp_dir = tmp_dir + + config_root = sys.argv.pop( 1 ) + config_file_name = sys.argv.pop( 1 ) + if not os.path.isabs( config_file_name ): + config_file_name = os.path.join( config_root, config_file_name ) # Set up reference to object store # First, read in the main config file for Galaxy; this is required because # the object store configuration is stored there conf = ConfigParser.ConfigParser() - config_file_name = 'universe_wsgi.ini' # Safe assumption? conf.read(config_file_name) conf_dict = {} for section in conf.sections(): @@ -59,7 +63,6 @@ galaxy.model.Dataset.object_store = object_store # Set up datatypes registry - config_root = sys.argv.pop( 1 ) datatypes_config = sys.argv.pop( 1 ) datatypes_registry = galaxy.datatypes.registry.Registry() datatypes_registry.load_datatypes( root_dir=config_root, config=datatypes_config ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket