mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #14524 from nsoranzo/misc_fixes_202208
Misc fixes 202208
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ https://help.github.com/en/github/getting-started-with-github/git-and-github-lea
|
||||
particular emphasis on readability being the ultimate goal:
|
||||
- 4 spaces (not tabs!) per indentation level
|
||||
- divergences from PEP-8 are listed in the `[flake8]` section of the
|
||||
`setup.cfg` file
|
||||
`.flake8` file
|
||||
- The Python code base is automatically formatted using
|
||||
[isort](https://pycqa.github.io/isort/) (for imports) and
|
||||
[black](https://black.readthedocs.io). To easily format your Python code
|
||||
|
||||
@@ -6,21 +6,6 @@ Created by Anne Pajon on 31 Jan 2012
|
||||
|
||||
Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute.
|
||||
|
||||
This source file is licensed under the Academic Free License version
|
||||
3.0 available at http://www.opensource.org/licenses/AFL-3.0.
|
||||
|
||||
Permission is hereby granted to reproduce, translate, adapt, alter,
|
||||
transform, modify, or arrange this source file (the "Original Work");
|
||||
to distribute or communicate copies of it under any license of your
|
||||
choice that does not contradict the terms and conditions; to perform
|
||||
or display the Original Work publicly.
|
||||
|
||||
THE ORIGINAL WORK IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS
|
||||
AND WITHOUT WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT
|
||||
LIMITATION, THE WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR
|
||||
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF
|
||||
THE ORIGINAL WORK IS WITH YOU.
|
||||
|
||||
Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample
|
||||
"""
|
||||
|
||||
|
||||
@@ -646,7 +646,7 @@ class DatasetCollector:
|
||||
def __init__(self, dataset_collection_description):
|
||||
self.discover_via = dataset_collection_description.discover_via
|
||||
# dataset_collection_description is an abstract description
|
||||
# built from the tool parsing module - see galaxy.tool_util.parser.output_colleciton_def
|
||||
# built from the tool parsing module - see galaxy.tool_util.parser.output_collection_def
|
||||
self.sort_key = dataset_collection_description.sort_key
|
||||
self.sort_reverse = dataset_collection_description.sort_reverse
|
||||
self.sort_comp = dataset_collection_description.sort_comp
|
||||
|
||||
@@ -2128,10 +2128,8 @@ class MinimalJobWrapper(HasResourceParameters):
|
||||
raise Exception(f"Unknown target type [{target}]")
|
||||
|
||||
def get_tool_provided_job_metadata(self):
|
||||
if self.tool_provided_job_metadata is not None:
|
||||
return self.tool_provided_job_metadata
|
||||
|
||||
self.tool_provided_job_metadata = self.tool.tool_provided_metadata(self)
|
||||
if self.tool_provided_job_metadata is None:
|
||||
self.tool_provided_job_metadata = self.tool.tool_provided_metadata(self)
|
||||
return self.tool_provided_job_metadata
|
||||
|
||||
def get_dataset_finish_context(self, job_context, output_dataset_assoc):
|
||||
|
||||
@@ -1322,9 +1322,9 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
|
||||
|
||||
def _tool_from_lineage_version(self, lineage_tool_version):
|
||||
if lineage_tool_version.id_based:
|
||||
return self._tools_by_id.get(lineage_tool_version.id, None)
|
||||
return self._tools_by_id.get(lineage_tool_version.id)
|
||||
else:
|
||||
return self._tool_versions_by_id.get(lineage_tool_version.id, {}).get(lineage_tool_version.version, None)
|
||||
return self._tool_versions_by_id.get(lineage_tool_version.id, {}).get(lineage_tool_version.version)
|
||||
|
||||
def _build_filter_method(self, trans):
|
||||
context = Bunch(toolbox=self, trans=trans)
|
||||
|
||||
@@ -1332,14 +1332,6 @@ def _verify_outputs(testdef, history, jobs, data_list, data_collection_list, gal
|
||||
|
||||
job_stdio = galaxy_interactor.get_job_stdio(job["id"])
|
||||
|
||||
if testdef.num_outputs is not None:
|
||||
expected = testdef.num_outputs
|
||||
actual = len(data_list) + len(data_collection_list)
|
||||
if expected != actual:
|
||||
message = f"Incorrect number of outputs - expected {expected}, found {actual}: datasets {data_list.keys()} collections {data_collection_list.keys()}"
|
||||
error = AssertionError(message)
|
||||
register_exception(error)
|
||||
|
||||
if testdef.num_outputs is not None:
|
||||
expected = testdef.num_outputs
|
||||
actual = len(data_list) + len(data_collection_list)
|
||||
|
||||
@@ -3528,7 +3528,7 @@ class RelabelFromFileTool(DatabaseOperationTool):
|
||||
add_copied_value_to_new_elements(new_labels[i], dce_object)
|
||||
for key in new_elements.keys():
|
||||
if not re.match(r"^[\w\- \.,]+$", key):
|
||||
raise Exception(f"Invalid new colleciton identifier [{key}]")
|
||||
raise Exception(f"Invalid new collection identifier [{key}]")
|
||||
self._add_datasets_to_history(history, new_elements.values())
|
||||
output_collections.create_collection(
|
||||
next(iter(self.outputs.values())), "output", elements=new_elements, propagate_hda_tags=False
|
||||
|
||||
@@ -33,7 +33,7 @@ if typing.TYPE_CHECKING:
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
SINGLE_EXECUTION_SUCCESS_MESSAGE = "Tool ${tool_id} created job ${job_id}"
|
||||
BATCH_EXECUTION_MESSAGE = "Executed ${job_count} job(s) for tool ${tool_id} request"
|
||||
BATCH_EXECUTION_MESSAGE = "Created ${job_count} job(s) for tool ${tool_id} request"
|
||||
|
||||
|
||||
class PartialJobExecution(Exception):
|
||||
|
||||
@@ -19,6 +19,7 @@ from urllib.parse import urlparse
|
||||
import mako.lookup
|
||||
import mako.runtime
|
||||
from apispec import APISpec
|
||||
from paste.urlmap import URLMap
|
||||
from sqlalchemy import (
|
||||
and_,
|
||||
true,
|
||||
@@ -47,6 +48,7 @@ from galaxy.web.framework import (
|
||||
helpers,
|
||||
url_for,
|
||||
)
|
||||
from galaxy.web.framework.middleware.static import CacheableStaticURLParser as Static
|
||||
|
||||
try:
|
||||
from importlib.resources import files # type: ignore[attr-defined]
|
||||
@@ -1114,10 +1116,6 @@ def default_url_path(path):
|
||||
|
||||
|
||||
def build_url_map(app, global_conf, **local_conf):
|
||||
from paste.urlmap import URLMap
|
||||
|
||||
from galaxy.web.framework.middleware.static import CacheableStaticURLParser as Static
|
||||
|
||||
urlmap = URLMap()
|
||||
# Merge the global and local configurations
|
||||
conf = global_conf.copy()
|
||||
|
||||
@@ -260,7 +260,7 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
return {"has_empty_inputs": has_empty_inputs, "has_duplicate_inputs": has_duplicate_inputs}
|
||||
|
||||
@expose_api
|
||||
def inputs(self, trans: ProvidesUserContext, id, **kwd):
|
||||
def inputs(self, trans: ProvidesUserContext, id, **kwd) -> List[dict]:
|
||||
"""
|
||||
GET /api/jobs/{id}/inputs
|
||||
|
||||
@@ -269,14 +269,14 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
:type id: string
|
||||
:param id: Encoded job id
|
||||
|
||||
:rtype: dictionary
|
||||
:returns: dictionary containing input dataset associations
|
||||
:rtype: list of dicts
|
||||
:returns: list of dictionaries containing input dataset associations
|
||||
"""
|
||||
job = self.__get_job(trans, id)
|
||||
return self.__dictify_associations(trans, job.input_datasets, job.input_library_datasets)
|
||||
|
||||
@expose_api
|
||||
def outputs(self, trans: ProvidesUserContext, id, **kwd):
|
||||
def outputs(self, trans: ProvidesUserContext, id, **kwd) -> List[dict]:
|
||||
"""
|
||||
outputs( trans, id )
|
||||
* GET /api/jobs/{id}/outputs
|
||||
@@ -285,8 +285,8 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
:type id: string
|
||||
:param id: Encoded job id
|
||||
|
||||
:rtype: dictionary
|
||||
:returns: dictionary containing output dataset associations
|
||||
:rtype: list of dicts
|
||||
:returns: list of dictionaries containing output dataset associations
|
||||
"""
|
||||
job = self.__get_job(trans, id)
|
||||
return self.__dictify_associations(trans, job.output_datasets, job.output_library_datasets)
|
||||
@@ -309,7 +309,7 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
return self.job_manager.stop(job, message=message)
|
||||
|
||||
@expose_api
|
||||
def resume(self, trans: ProvidesUserContext, id, **kwd):
|
||||
def resume(self, trans: ProvidesUserContext, id, **kwd) -> List[dict]:
|
||||
"""
|
||||
* PUT /api/jobs/{id}/resume
|
||||
Resumes a paused job
|
||||
@@ -317,8 +317,8 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
:type id: string
|
||||
:param id: Encoded job id
|
||||
|
||||
:rtype: dictionary
|
||||
:returns: dictionary containing output dataset associations
|
||||
:rtype: list of dicts
|
||||
:returns: list of dictionaries containing output dataset associations
|
||||
"""
|
||||
job = self.__get_job(trans, id)
|
||||
if not job:
|
||||
@@ -425,13 +425,13 @@ class JobController(BaseGalaxyAPIController, UsesVisualizationMixin):
|
||||
raise exceptions.ConfigDoesNotAllowException(f"Tool '{job.tool_id}' cannot be rerun.")
|
||||
return tool.to_json(trans, {}, job=job)
|
||||
|
||||
def __dictify_associations(self, trans, *association_lists):
|
||||
rval = []
|
||||
def __dictify_associations(self, trans, *association_lists) -> List[dict]:
|
||||
rval: List[dict] = []
|
||||
for association_list in association_lists:
|
||||
rval.extend(self.__dictify_association(trans, a) for a in association_list)
|
||||
return rval
|
||||
|
||||
def __dictify_association(self, trans, job_dataset_association):
|
||||
def __dictify_association(self, trans, job_dataset_association) -> dict:
|
||||
dataset_dict = None
|
||||
dataset = job_dataset_association.dataset
|
||||
if dataset:
|
||||
|
||||
@@ -434,7 +434,7 @@ class HistoryContentsApiTestCase(ApiTestCase):
|
||||
assert post_combined_count == pre_combined_count + 1
|
||||
assert pre_dataset_count == post_dataset_count
|
||||
|
||||
# Test show dataset colleciton.
|
||||
# Test show dataset collection.
|
||||
collection_url = f"histories/{self.history_id}/contents/dataset_collections/{dataset_collection['id']}"
|
||||
show_response = self._get(collection_url)
|
||||
self._assert_status_code_is(show_response, 200)
|
||||
|
||||
@@ -2662,7 +2662,7 @@ class BaseDatasetCollectionPopulator:
|
||||
return element_identifiers
|
||||
|
||||
def __create(self, payload, wait=False):
|
||||
# Create a colleciton - either from existing datasets using collection creation API
|
||||
# Create a collection - either from existing datasets using collection creation API
|
||||
# or from direct uploads with the fetch API. Dispatch on "targets" keyword in payload
|
||||
# to decide which to use.
|
||||
if "targets" not in payload:
|
||||
|
||||
@@ -43,8 +43,6 @@ from . import (
|
||||
# Set a 10 minute timeout for repository installation.
|
||||
repository_installation_timeout = 600
|
||||
|
||||
# Dial ClientCookie logging down (very noisy)
|
||||
logging.getLogger("ClientCookie.cookies").setLevel(logging.WARNING)
|
||||
log = logging.getLogger(__name__)
|
||||
tc.options["equiv_refresh_interval"] = 0
|
||||
|
||||
|
||||
@@ -212,16 +212,17 @@ def get_repository_file_contents(app, file_path, repository_id, is_admin=False):
|
||||
elif checkers.check_binary(file_path):
|
||||
return "<br/>Binary file<br/>"
|
||||
else:
|
||||
for line in open(file_path):
|
||||
safe_str = f"{safe_str}{basic_util.to_html_string(line)}"
|
||||
# Stop reading after string is larger than MAX_CONTENT_SIZE.
|
||||
if len(safe_str) > MAX_CONTENT_SIZE:
|
||||
large_str = (
|
||||
"<br/>File contents truncated because file size is larger than maximum viewing size of %s<br/>"
|
||||
% util.nice_size(MAX_CONTENT_SIZE)
|
||||
)
|
||||
safe_str = f"{safe_str}{large_str}"
|
||||
break
|
||||
with open(file_path) as fh:
|
||||
for line in fh:
|
||||
safe_str = f"{safe_str}{basic_util.to_html_string(line)}"
|
||||
# Stop reading after string is larger than MAX_CONTENT_SIZE.
|
||||
if len(safe_str) > MAX_CONTENT_SIZE:
|
||||
large_str = (
|
||||
"<br/>File contents truncated because file size is larger than maximum viewing size of %s<br/>"
|
||||
% util.nice_size(MAX_CONTENT_SIZE)
|
||||
)
|
||||
safe_str = f"{safe_str}{large_str}"
|
||||
break
|
||||
|
||||
if len(safe_str) > basic_util.MAX_DISPLAY_SIZE:
|
||||
# Eliminate the middle of the file to display a file no larger than basic_util.MAX_DISPLAY_SIZE.
|
||||
|
||||
@@ -11,6 +11,10 @@ from typing import (
|
||||
TYPE_CHECKING,
|
||||
)
|
||||
|
||||
from mercurial import (
|
||||
hg,
|
||||
ui,
|
||||
)
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
Column,
|
||||
@@ -414,11 +418,6 @@ class Repository(Base, Dictifiable, _HasTable):
|
||||
|
||||
@property
|
||||
def hg_repo(self):
|
||||
from mercurial import (
|
||||
hg,
|
||||
ui,
|
||||
)
|
||||
|
||||
if not WEAK_HG_REPO_CACHE.get(self):
|
||||
WEAK_HG_REPO_CACHE[self] = hg.cachedlocalrepo(hg.repository(ui.ui(), self.repo_path().encode("utf-8")))
|
||||
return WEAK_HG_REPO_CACHE[self].fetch()[0]
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ cwltool = "==3.1.20211107152837"
|
||||
dictobj = "*"
|
||||
docutils = "!=0.17, !=0.17.1"
|
||||
edam-ontology = "*"
|
||||
fastapi = ">=0.68.2, !=0.69.0, !=0.70.0, !=0.70.1" # https://github.com/tiangolo/fastapi/issues/4041
|
||||
fastapi = ">=0.71.0" # https://github.com/tiangolo/fastapi/issues/4041
|
||||
fastapi-utils = "*"
|
||||
fs = "*"
|
||||
future = "*"
|
||||
|
||||
Reference in New Issue
Block a user