commit/galaxy-central: natefoo: Properly handle subdirectory collection in a job output's extra_files_path.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ddb55ff5fd1c/ changeset: ddb55ff5fd1c user: natefoo date: 2013-02-19 16:07:14 summary: Properly handle subdirectory collection in a job output's extra_files_path. affected #: 1 file diff -r 90f3b97fba53d68f955ddce9de97d12e10763b45 -r ddb55ff5fd1cdb5c2510eef55ab8d427c9e54003 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2635,19 +2635,26 @@ """ for name, hda in output.items(): temp_file_path = os.path.join( job_working_directory, "dataset_%s_files" % ( hda.dataset.id ) ) + extra_dir = None try: - a_files = os.listdir( temp_file_path ) - if len( a_files ) > 0: - for f in a_files: + # This skips creation of directories - object store + # automatically creates them. However, empty directories will + # not be created in the object store at all, which might be a + # problem. + for root, dirs, files in os.walk( temp_file_path ): + extra_dir = root.replace(job_working_directory, '', 1).lstrip(os.path.sep) + for f in files: self.app.object_store.update_from_file(hda.dataset, - extra_dir="dataset_%d_files" % hda.dataset.id, + extra_dir=extra_dir, alt_name = f, - file_name = os.path.join(temp_file_path, f), + file_name = os.path.join(root, f), create = True, preserve_symlinks = True ) - # Clean up after being handled by object store. - # FIXME: If the object (e.g., S3) becomes async, this will - # cause issues so add it to the object store functionality? + # Clean up after being handled by object store. + # FIXME: If the object (e.g., S3) becomes async, this will + # cause issues so add it to the object store functionality? + if extra_dir is not None: + # there was an extra_files_path dir, attempt to remove it shutil.rmtree(temp_file_path) except Exception, e: log.debug( "Error in collect_associated_files: %s" % ( e ) ) 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