From 1c02a2009c1b6805d8f5c7cdb01c6212777ea7e3 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 12 Aug 2020 18:08:26 +0200 Subject: [PATCH 01/10] Handle python2-related syntax errors in Cheetah code Also drops conditional behavior on Python 2, sice we don't support that anymore. Fixes cmsearch and cmscan, reported by @mmiladi on gitter. Without this you'd see the following traceback: ``` Error in the Python code which Cheetah generated for this template: ================================================================================ invalid syntax (cheetah_DynamicallyCompiledCheetahTemplate_1597222728_2079988_77368.py, line 130) Line Job Traceback Traceback (most recent call last): File "/opt/galaxy/venv3/lib64/python3.6/site-packages/Cheetah/Template.py", line 823, in compile co = compile(generatedModuleCode, __file__, 'exec') File "cheetah_DynamicallyCompiledCheetahTemplate_1597222728_2079988_77368.py", line 130 if VFFSL(SL,"smxsize",True) <> 128.0: # generated from line 17, col 13 ^ SyntaxError: invalid syntax During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/galaxy/server/lib/galaxy/jobs/runners/__init__.py", line 236, in prepare_job job_wrapper.prepare() File "/opt/galaxy/server/lib/galaxy/jobs/__init__.py", line 1107, in prepare self.command_line, self.extra_filenames, self.environment_variables = tool_evaluator.build() File "/opt/galaxy/server/lib/galaxy/tools/evaluation.py", line 475, in build raise e File "/opt/galaxy/server/lib/galaxy/tools/evaluation.py", line 471, in build self.__build_command_line() File "/opt/galaxy/server/lib/galaxy/tools/evaluation.py", line 496, in __build_command_line command_line = fill_template(command, context=param_dict, python_template_version=self.tool.python_template_version) File "/opt/galaxy/server/lib/galaxy/util/template.py", line 64, in fill_template klass = Template.compile(source=template_text, compilerClass=compiler_class) File "/opt/galaxy/venv3/lib64/python3.6/site-packages/Cheetah/Template.py", line 834, in compile raise parseError Cheetah.Parser.ParseError: Error in the Python code which Cheetah generated for this template: ================================================================================ invalid syntax (cheetah_DynamicallyCompiledCheetahTemplate_1597222728_2079988_77368.py, line 130) Line|Python Code ----|------------------------------------------------------------- 128 | write(''' 129 |''') 130 | if VFFSL(SL,"smxsize",True) <> 128.0: # generated from line 17, col 13 ^ 131 | _v = VFFSL(SL,"smxsize",True) # '$smxsize' on line 18, col 27 132 | if _v is not None: write(_filter(_v, rawExpr='$smxsize')) # from line 18, col 27. 133 | write(''' ================================================================================ Here is the corresponding Cheetah code: Line 17, column 13 Line|Cheetah Code ----|------------------------------------------------------------- 14 | $notrunc 15 | $anytrunc 16 | $nonull3 17 | #if $smxsize <> 128.0 ^ 18 | --smxsize $smxsize 19 | #end if 20 | #if $mxsize <> 128.0 ``` --- lib/galaxy/util/template.py | 33 +++++++++++++++++++-------- test/unit/tools/test_fill_template.py | 11 +++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/lib/galaxy/util/template.py b/lib/galaxy/util/template.py index 36abe048b48..5f67b4bac77 100644 --- a/lib/galaxy/util/template.py +++ b/lib/galaxy/util/template.py @@ -1,13 +1,13 @@ """Entry point for the usage of Cheetah templating within Galaxy.""" from __future__ import absolute_import -import sys import traceback from lib2to3.refactor import RefactoringTool import packaging.version from Cheetah.Compiler import Compiler from Cheetah.NameMapper import NotFound +from Cheetah.Parser import ParseError from Cheetah.Template import Template from past.translation import myfixes @@ -15,11 +15,8 @@ from . import unicodify # Skip libpasteurize fixers, which make sure code is py2 and py3 compatible. # This is not needed, we only translate code on py3. -if sys.version_info.major > 2: - myfixes = [f for f in myfixes if not f.startswith('libpasteurize')] - refactoring_tool = RefactoringTool(myfixes, {'print_function': True}) -else: - myfixes = refactoring_tool = None +myfixes = [f for f in myfixes if not f.startswith('libpasteurize')] +refactoring_tool = RefactoringTool(myfixes, {'print_function': True}) class FixedModuleCodeCompiler(Compiler): @@ -61,14 +58,32 @@ def fill_template(template_text, context = kwargs if isinstance(python_template_version, str): python_template_version = packaging.version.parse(python_template_version) - klass = Template.compile(source=template_text, compilerClass=compiler_class) + try: + klass = Template.compile(source=template_text, compilerClass=compiler_class) + except ParseError as e: + # Might happen on invalid syntax within a cheetah statement, like `#if $smxsize <> 128.0` + if first_exception is None: + first_exception = e + if python_template_version.release[0] < 3 and retry > 0: + module_code = Template.compile(source=template_text, compilerClass=compiler_class, returnAClass=False).decode('utf-8') + module_code = futurize_preprocessor(module_code) + compiler_class = create_compiler_class(module_code) + return fill_template( + template_text=template_text, + context=context, + retry=retry - 1, + compiler_class=compiler_class, + first_exception=first_exception, + python_template_version=python_template_version, + ) + raise first_exception or e t = klass(searchList=[context]) try: return unicodify(t) except NotFound as e: if first_exception is None: first_exception = e - if refactoring_tool and python_template_version.release[0] < 3 and retry > 0: + if python_template_version.release[0] < 3 and retry > 0: tb = e.__traceback__ last_stack = traceback.extract_tb(tb)[-1] if last_stack.name == '': @@ -95,7 +110,7 @@ def fill_template(template_text, except Exception as e: if first_exception is None: first_exception = e - if sys.version_info.major > 2 and python_template_version.release[0] < 3 and not futurized: + if python_template_version.release[0] < 3 and not futurized: # Possibly an error caused by attempting to run python 2 # template code on python 3. Run the generated module code # through futurize and hope for the best. diff --git a/test/unit/tools/test_fill_template.py b/test/unit/tools/test_fill_template.py index f0d13e38b1e..af61e520b00 100644 --- a/test/unit/tools/test_fill_template.py +++ b/test/unit/tools/test_fill_template.py @@ -37,6 +37,12 @@ TWO_TO_THREE_TEMPLATE = """#set $a = [x for x in {'a': '1'}.iterkeys()][0] #set $c = [x for x in {'a': '1'}.itervalues()][0] $a $b $c""" +INVALID_CHEETAH_SYNTAX = """#if 1 <> 1 +1 is not 1 +#else +1 is 1 +#end if""" + def test_fill_simple_template(): template_str = str(fill_template(SIMPLE_TEMPLATE, {'a_list': [1, 2]})) @@ -75,3 +81,8 @@ def test_gen_expr(): def test_fix_template_two_to_three(): template_str = fill_template(TWO_TO_THREE_TEMPLATE, python_template_version='2', retry=1) assert template_str == 'a a 1' + + +def test_fix_template_invalid_cheetah(): + template_str = fill_template(INVALID_CHEETAH_SYNTAX, python_template_version='2', retry=1) + assert template_str == "1 is 1\n" From 2b1d29cdcf8fff15cd553eaa86958caac46d1bbb Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Aug 2020 11:50:12 +0200 Subject: [PATCH 02/10] Extend test cases to use outputs_to_working_dir and metadata_strategy extended --- .../objectstore/test_objectstore_datatype_upload.py | 3 +-- test/integration/objectstore/test_selection.py | 9 +++++++++ test/integration/objectstore/test_swift_objectstore.py | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/test/integration/objectstore/test_objectstore_datatype_upload.py b/test/integration/objectstore/test_objectstore_datatype_upload.py index f1059e7a7d6..5a2ef4e6bcb 100644 --- a/test/integration/objectstore/test_objectstore_datatype_upload.py +++ b/test/integration/objectstore/test_objectstore_datatype_upload.py @@ -112,8 +112,7 @@ class BaseObjectstoreUploadTest(UploadTestDatatypeDataTestCase): temp_directory = cls._test_driver.mkdtemp() cls.object_stores_parent = temp_directory cls.object_store_config_path = os.path.join(temp_directory, "object_store_conf.xml") - # This doesn't quite work yet, fails with extra_files_path - # config["metadata_strategy"] = "extended" + config["metadata_strategy"] = "extended" config["outpus_to_working_dir"] = True config["retry_metadata_internally"] = False config["object_store_store_by"] = "uuid" diff --git a/test/integration/objectstore/test_selection.py b/test/integration/objectstore/test_selection.py index 75f9f7c73b5..dd4c0e3dd28 100644 --- a/test/integration/objectstore/test_selection.py +++ b/test/integration/objectstore/test_selection.py @@ -44,6 +44,9 @@ class ObjectStoreSelectionIntegrationTestCase(BaseObjectStoreIntegrationTestCase cls._configure_object_store(DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE, config) config["job_config_file"] = JOB_CONFIG_FILE config["job_resource_params_file"] = JOB_RESOURCE_PARAMETERS_CONFIG_FILE + config["object_store_store_by"] = "uuid" + config["metadata_strategy"] = "extended" + config["outputs_to_working_directory"] = True def _object_store_counts(self): files_default_count = files_count(self.files_default_path) @@ -61,6 +64,11 @@ class ObjectStoreSelectionIntegrationTestCase(BaseObjectStoreIntegrationTestCase assert dynamic_ebs == files_dynamic_ebs_count assert dynamic_s3 == files_dynamic_s3_count + def _assert_no_external_filename(self): + # Should maybe be its own test case ... + for external_filename_tuple in self._app.model.session.query(self._app.model.Dataset.external_filename).all(): + assert external_filename_tuple[0] is None + def test_tool_simple_constructs(self): with self.dataset_populator.test_history() as history_id: @@ -103,3 +111,4 @@ class ObjectStoreSelectionIntegrationTestCase(BaseObjectStoreIntegrationTestCase } _run_tool("create_10", create_10_inputs) self._assert_file_counts(1, 2, 10, 10) + self._assert_no_external_filename() diff --git a/test/integration/objectstore/test_swift_objectstore.py b/test/integration/objectstore/test_swift_objectstore.py index c3e90af1506..0ee10a4b462 100644 --- a/test/integration/objectstore/test_swift_objectstore.py +++ b/test/integration/objectstore/test_swift_objectstore.py @@ -89,8 +89,7 @@ class SwiftObjectStoreIntegrationTestCase(integration_util.IntegrationTestCase): cls.object_stores_parent = temp_directory config_path = os.path.join(temp_directory, "object_store_conf.xml") config["object_store_store_by"] = "uuid" - # This doesn't quite work yet, fails with extra_files_path - # config["metadata_strategy"] = "extended" + config["metadata_strategy"] = "extended" config["outpus_to_working_dir"] = True config["retry_metadata_internally"] = False with open(config_path, "w") as f: From 17c953cadbc985b31b55594d8237396b53543987 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Aug 2020 11:47:43 +0200 Subject: [PATCH 03/10] Make sure file path in object store is always absolute Otherwise when loading the serialized object store during extended metadata setting the path will expand relative to the job working directory. --- lib/galaxy/objectstore/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/objectstore/__init__.py b/lib/galaxy/objectstore/__init__.py index 848678368c6..69b5a6a1ac0 100644 --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -372,7 +372,7 @@ class DiskObjectStore(ConcreteObjectStore): :param extra_dirs: Keys are string, values are directory paths. """ super(DiskObjectStore, self).__init__(config, config_dict) - self.file_path = config_dict.get("files_dir") or config.file_path + self.file_path = os.path.abspath(config_dict.get("files_dir") or config.file_path) @classmethod def parse_xml(clazz, config_xml): From c035e1b34f0ec43d5e31582fae90dfacc1b914a6 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Aug 2020 12:01:07 +0200 Subject: [PATCH 04/10] Fix populating object store from correct file And reset temporary external_filename before writing to export store. Also drops unreachable code. Fixes https://github.com/galaxyproject/galaxy/issues/9968 --- lib/galaxy/metadata/set_metadata.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/metadata/set_metadata.py b/lib/galaxy/metadata/set_metadata.py index c8077132cc4..80780bf8116 100644 --- a/lib/galaxy/metadata/set_metadata.py +++ b/lib/galaxy/metadata/set_metadata.py @@ -237,7 +237,7 @@ def set_metadata_portable(): dataset.set_size() if 'uuid' in context: dataset.dataset.uuid = context['uuid'] - object_store.update_from_file(dataset.dataset, create=True) + object_store.update_from_file(dataset.dataset, file_name=dataset_filename_override, create=True) from galaxy.job_execution.output_collect import collect_extra_files collect_extra_files(object_store, dataset, ".") if galaxy.model.Job.states.ERROR == final_job_state: @@ -265,11 +265,8 @@ def set_metadata_portable(): if context_key in context: context_value = context[context_key] setattr(dataset, context_key, context_value) - - if extended_metadata_collection: - export_store.add_dataset(dataset) - else: - cPickle.dump(dataset, open(filename_out, 'wb+')) + dataset.dataset.external_filename = None + export_store.add_dataset(dataset) else: dataset.metadata.to_JSON_dict(filename_out) # write out results of set_meta From 9a8aea1f66e7592408c6da1faa1ce21f6f55a63e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Aug 2020 13:36:40 +0200 Subject: [PATCH 05/10] Don't use metadata_strategy: extended when setting meta for existing file Otherwise the outputs would be overwritten and the job attributes for the metadata job would overwrite the attributes of the job that created the dataset. We may want to eventually modify this in extended_metadata_collection mode, but that is probably a bit more involved. --- lib/galaxy/jobs/__init__.py | 2 +- lib/galaxy/metadata/__init__.py | 4 ++-- lib/galaxy/tools/__init__.py | 2 +- lib/galaxy/tools/actions/metadata.py | 2 +- test/unit/jobs/test_job_wrapper.py | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index cfea0af1249..225819929b2 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -919,7 +919,7 @@ class JobWrapper(HasResourceParameters): metadata_strategy_override = None if job.tasks: metadata_strategy_override = "directory" - self.external_output_metadata = get_metadata_compute_strategy(self.app.config, job.id, metadata_strategy_override=metadata_strategy_override) + self.external_output_metadata = get_metadata_compute_strategy(self.app.config, job.id, metadata_strategy_override=metadata_strategy_override, tool_id=job.tool_id) self.__commands_in_new_shell = True self.__user_system_pwent = None diff --git a/lib/galaxy/metadata/__init__.py b/lib/galaxy/metadata/__init__.py index 741ac641eb8..a963ce3e13d 100644 --- a/lib/galaxy/metadata/__init__.py +++ b/lib/galaxy/metadata/__init__.py @@ -22,11 +22,11 @@ log = getLogger(__name__) SET_METADATA_SCRIPT = 'from galaxy_ext.metadata.set_metadata import set_metadata; set_metadata()' -def get_metadata_compute_strategy(config, job_id, metadata_strategy_override=None): +def get_metadata_compute_strategy(config, job_id, metadata_strategy_override=None, tool_id=None): metadata_strategy = metadata_strategy_override or config.metadata_strategy if metadata_strategy == "legacy": return JobExternalOutputMetadataWrapper(job_id) - elif metadata_strategy == "extended": + elif metadata_strategy == "extended" and tool_id != "__SET_METADATA__": return ExtendedDirectoryMetadataGenerator(job_id) else: return PortableDirectoryMetadataGenerator(job_id) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 44cd161b217..556087ee261 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2538,7 +2538,7 @@ class SetMetadataTool(Tool): job, base_dir='job_work', dir_only=True, obj_dir=True ) for name, dataset in inp_data.items(): - external_metadata = get_metadata_compute_strategy(app.config, job.id) + external_metadata = get_metadata_compute_strategy(app.config, job.id, tool_id=self.id) sa_session = app.model.context metadata_set_successfully = external_metadata.external_metadata_set_successfully(dataset, name, sa_session, working_directory=working_directory) if metadata_set_successfully: diff --git a/lib/galaxy/tools/actions/metadata.py b/lib/galaxy/tools/actions/metadata.py index 5667b6b770f..325d3825fef 100644 --- a/lib/galaxy/tools/actions/metadata.py +++ b/lib/galaxy/tools/actions/metadata.py @@ -85,7 +85,7 @@ class SetMetadataToolAction(ToolAction): job_working_dir = app.object_store.get_filename(job, base_dir='job_work', dir_only=True, extra_dir=str(job.id)) datatypes_config = os.path.join(job_working_dir, 'registry.xml') app.datatypes_registry.to_xml_file(path=datatypes_config) - external_metadata_wrapper = get_metadata_compute_strategy(app.config, job.id) + external_metadata_wrapper = get_metadata_compute_strategy(app.config, job.id, tool_id=tool.id) output_datatasets_dict = { dataset_name: dataset, } diff --git a/test/unit/jobs/test_job_wrapper.py b/test/unit/jobs/test_job_wrapper.py index 30289b74118..f0d98346159 100644 --- a/test/unit/jobs/test_job_wrapper.py +++ b/test/unit/jobs/test_job_wrapper.py @@ -163,6 +163,7 @@ class MockTool(object): self.tool_dir = "/path/to/tools" self.dependencies = [] self.requires_galaxy_python_environment = False + self.id = 'mock_id' def build_dependency_shell_commands(self, job_directory): return TEST_DEPENDENCIES_COMMANDS From f522f7f24fc9e96442b36ad80e18a34c136f1585 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 13 Aug 2020 15:52:11 +0200 Subject: [PATCH 06/10] Only move primary outputs to object store if using outputs_tto_working_directory --- lib/galaxy/metadata/set_metadata.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/metadata/set_metadata.py b/lib/galaxy/metadata/set_metadata.py index 80780bf8116..483f9450529 100644 --- a/lib/galaxy/metadata/set_metadata.py +++ b/lib/galaxy/metadata/set_metadata.py @@ -168,7 +168,6 @@ def set_metadata_portable(): if os.path.exists(COMMAND_VERSION_FILENAME): version_string = open(COMMAND_VERSION_FILENAME).read() - # TODO: handle outputs_to_working_directory? from galaxy.util.expressions import ExpressionContext job_context = ExpressionContext(dict(stdout=tool_stdout, stderr=tool_stderr)) @@ -237,7 +236,10 @@ def set_metadata_portable(): dataset.set_size() if 'uuid' in context: dataset.dataset.uuid = context['uuid'] - object_store.update_from_file(dataset.dataset, file_name=dataset_filename_override, create=True) + if dataset_filename_override and dataset_filename_override != dataset.file_name: + # This has to be a job with outputs_to_working_directory set. + # We update the object store with the created output file. + object_store.update_from_file(dataset.dataset, file_name=dataset_filename_override, create=True) from galaxy.job_execution.output_collect import collect_extra_files collect_extra_files(object_store, dataset, ".") if galaxy.model.Job.states.ERROR == final_job_state: @@ -265,6 +267,7 @@ def set_metadata_portable(): if context_key in context: context_value = context[context_key] setattr(dataset, context_key, context_value) + # We never want to persist the external_filename. dataset.dataset.external_filename = None export_store.add_dataset(dataset) else: From 89efed4b0ccb7da86214e01db0b27172cbb45f01 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 19 Aug 2020 08:27:40 -0400 Subject: [PATCH 07/10] Open pages API a bit to allow anonymous users to view published pages. --- lib/galaxy/webapps/galaxy/api/pages.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/pages.py b/lib/galaxy/webapps/galaxy/api/pages.py index e14ffa4161b..e0c5c3fc6e5 100644 --- a/lib/galaxy/webapps/galaxy/api/pages.py +++ b/lib/galaxy/webapps/galaxy/api/pages.py @@ -11,7 +11,11 @@ from galaxy.managers.pages import ( PageSerializer ) from galaxy.model.item_attrs import UsesAnnotations -from galaxy.web import expose_api, expose_api_raw +from galaxy.web import ( + expose_api, + expose_api_anonymous_and_sessionless, + expose_api_raw_anonymous_and_sessionless +) from galaxy.webapps.base.controller import ( BaseAPIController, SharableItemSecurityMixin, @@ -31,7 +35,7 @@ class PagesController(BaseAPIController, SharableItemSecurityMixin, UsesAnnotati self.manager = PageManager(app) self.serializer = PageSerializer(app) - @expose_api + @expose_api_anonymous_and_sessionless def index(self, trans, deleted=False, **kwd): """ index( self, trans, deleted=False, **kwd ) @@ -52,12 +56,14 @@ class PagesController(BaseAPIController, SharableItemSecurityMixin, UsesAnnotati for row in r: out.append(self.encode_all_ids(trans, row.to_dict(), True)) else: + # Transaction user's pages (if any) user = trans.get_user() r = trans.sa_session.query(trans.app.model.Page).filter_by(user=user) if not deleted: r = r.filter_by(deleted=False) for row in r: out.append(self.encode_all_ids(trans, row.to_dict(), True)) + # Published pages from other users r = trans.sa_session.query(trans.app.model.Page).filter(trans.app.model.Page.user != user).filter_by(published=True) if not deleted: r = r.filter_by(deleted=False) @@ -108,7 +114,7 @@ class PagesController(BaseAPIController, SharableItemSecurityMixin, UsesAnnotati trans.sa_session.flush() return '' # TODO: Figure out what to return on DELETE, document in guidelines! - @expose_api + @expose_api_anonymous_and_sessionless def show(self, trans, id, **kwd): """ show( self, trans, id, **kwd ) @@ -127,7 +133,7 @@ class PagesController(BaseAPIController, SharableItemSecurityMixin, UsesAnnotati self.manager.rewrite_content_for_export(trans, rval) return rval - @expose_api_raw + @expose_api_raw_anonymous_and_sessionless def show_pdf(self, trans, id, **kwd): """ show( self, trans, id, **kwd ) From dea8baf644739d315e8b8a32b91d03cd883eb173 Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 4 Aug 2020 10:25:44 -0400 Subject: [PATCH 08/10] Fix error in get_open_tempfile() --- lib/galaxy/datatypes/util/maf_utilities.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/util/maf_utilities.py b/lib/galaxy/datatypes/util/maf_utilities.py index ce7b97ea5c0..7af49594818 100644 --- a/lib/galaxy/datatypes/util/maf_utilities.py +++ b/lib/galaxy/datatypes/util/maf_utilities.py @@ -85,6 +85,7 @@ class TempFileHandler(object): if index is None: index = len(self.files) temp_kwds = dict(self.kwds) + temp_kwds['delete'] = False temp_kwds.update(kwds) # Being able to use delete=True here, would simplify a bit, # but we support python2.4 in these tools @@ -100,11 +101,11 @@ class TempFileHandler(object): else: raise e tmp_file.close() - self.files.append(open(filename, 'w')) + self.files.append(open(filename, 'r+')) else: while True: try: - self.files[index] = open(self.files[index].name, 'r') + self.files[index] = open(self.files[index].name, 'r+') break except OSError as e: if self.open_file_indexes and e.errno == EMFILE: From 3e132196228008140a984b10018a1e331d235836 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Sat, 22 Aug 2020 09:33:23 -0400 Subject: [PATCH 09/10] Update toolshed/ie js dist locations --- .../interactive_environments/common/templates/ie.mako | 6 +++--- lib/tool_shed/webapp/templates/base.mako | 8 ++++---- lib/tool_shed/webapp/templates/base/base_panels.mako | 8 ++++---- .../templates/webapps/tool_shed/repository/upload.mako | 1 - .../tool_shed_repository/browse_tool_dependency.mako | 1 - 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/config/plugins/interactive_environments/common/templates/ie.mako b/config/plugins/interactive_environments/common/templates/ie.mako index 98fe7919c46..ba4c774018b 100644 --- a/config/plugins/interactive_environments/common/templates/ie.mako +++ b/config/plugins/interactive_environments/common/templates/ie.mako @@ -1,8 +1,8 @@ <%def name="load_default_js()"> ${h.css( 'base' ) } -${h.js('bundled/libs.chunk', - 'bundled/base.chunk', - 'bundled/generic.bundled')} +${h.dist_js('libs.chunk', + 'base.chunk', + 'generic.bundled')} <%def name="default_javascript_variables()"> diff --git a/lib/tool_shed/webapp/templates/base.mako b/lib/tool_shed/webapp/templates/base.mako index 8c6e3f2ba1d..c72f5687ddf 100644 --- a/lib/tool_shed/webapp/templates/base.mako +++ b/lib/tool_shed/webapp/templates/base.mako @@ -50,15 +50,15 @@ ## Default javascripts <%def name="javascripts()"> ## TODO: remove when all libs are required directly in modules - ${h.js( - 'bundled/libs.chunk', - 'bundled/base.chunk' + ${h.dist_js( + 'libs.chunk', + 'base.chunk' )} ${self.javascript_entry()} <%def name="javascript_entry()"> - ${h.js('bundled/generic.bundled')} + ${h.dist_js('generic.bundled')} <%def name="javascript_app()"> diff --git a/lib/tool_shed/webapp/templates/base/base_panels.mako b/lib/tool_shed/webapp/templates/base/base_panels.mako index 4a231563b5f..1e1f81ac5d6 100644 --- a/lib/tool_shed/webapp/templates/base/base_panels.mako +++ b/lib/tool_shed/webapp/templates/base/base_panels.mako @@ -29,16 +29,16 @@ ## TODO: remove when all libs are required directly in modules <%def name="javascripts()"> - ${h.js( - 'bundled/libs.chunk', - 'bundled/base.chunk' + ${h.dist_js( + 'libs.chunk', + 'base.chunk' )} ${ javascript_entry() } <%def name="javascript_entry()"> - ${ h.js('bundled/generic.bundled')} + ${ h.dist_js('generic.bundled')} <%def name="javascript_app()"> diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/upload.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/upload.mako index e2fc5dd4306..634f957817e 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/upload.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/upload.mako @@ -23,7 +23,6 @@ <%def name="javascripts()"> ${parent.javascripts()} - ## ${h.js( "libs/jquery/jquery-ui", "libs/jquery/jquery.cookie", "libs/jquery/jquery.dynatree" )} ${common_javascripts(repository)}