Merge branch 'release_22.01' into dev

This commit is contained in:
Nicola Soranzo
2022-02-24 11:56:51 +00:00
9 changed files with 280 additions and 584 deletions
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -3433,9 +3433,7 @@ class SortTool(DatabaseOperationTool):
presort_elements = [(dce.element_identifier, dce) for dce in elements]
elif sorttype == "numeric":
presort_elements = [(int(re.sub("[^0-9]", "", dce.element_identifier)), dce) for dce in elements]
if presort_elements:
sorted_elements = [x[1] for x in sorted(presort_elements, key=lambda x: x[0])]
if sorttype == "file":
elif sorttype == "file":
hda = incoming["sort_type"]["sort_file"]
data_lines = hda.metadata.get("data_lines", 0)
if data_lines == len(elements):
@@ -3450,8 +3448,13 @@ class SortTool(DatabaseOperationTool):
message = f"List of element identifiers does not match element identifiers in collection '{hdca_history_name}'"
raise Exception(message)
else:
message = "Number of lines must match number of list elements (%i), but file has %i lines"
raise Exception(message % (data_lines, len(elements)))
message = f"Number of lines must match number of list elements ({len(elements)}), but file has {data_lines} lines"
raise Exception(message)
else:
raise Exception(f"Unknown sort_type '{sorttype}'")
if presort_elements:
sorted_elements = [x[1] for x in sorted(presort_elements, key=lambda x: x[0])]
for dce in sorted_elements:
dce_object = dce.element_object
+1 -1
View File
@@ -276,7 +276,7 @@ class UWSGIApplicationStack(MessageApplicationStack):
name = "uWSGI"
prohibited_middleware = frozenset(
{
"wrap_in_static",
"build_url_map",
"EvalException",
}
)
+2 -2
View File
@@ -1044,7 +1044,7 @@ def build_native_uwsgi_app(paste_factory, config_section):
return uwsgi_app
def build_url_map(app, global_conf, local_conf):
def build_url_map(app, global_conf, **local_conf):
from paste.urlmap import URLMap
from galaxy.web.framework.middleware.static import CacheableStaticURLParser as Static
@@ -1076,4 +1076,4 @@ def build_url_map(app, global_conf, local_conf):
if "static_local_dir" in conf:
urlmap["/static_local"] = Static(conf["static_local_dir"], cache_time)
return urlmap, cache_time
return urlmap
+2 -12
View File
@@ -25,6 +25,7 @@ from galaxy.web.framework.middleware.batch import BatchMiddleware
from galaxy.web.framework.middleware.error import ErrorMiddleware
from galaxy.web.framework.middleware.request_id import RequestIDMiddleware
from galaxy.web.framework.middleware.xforwardedhost import XForwardedHostMiddleware
from galaxy.webapps.base.webapp import build_url_map
from galaxy.webapps.util import wrap_if_allowed
log = logging.getLogger(__name__)
@@ -264,13 +265,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs):
if kwargs.get("middleware", True):
webapp = wrap_in_middleware(webapp, global_conf, app.application_stack, **kwargs)
if asbool(kwargs.get("static_enabled", True)):
webapp = wrap_if_allowed(
webapp,
app.application_stack,
wrap_in_static,
args=(global_conf,),
kwargs=dict(plugin_frameworks=[app.visualizations_registry], **kwargs),
)
webapp = wrap_if_allowed(webapp, app.application_stack, build_url_map, args=(global_conf,), kwargs=kwargs)
app.application_stack.register_postfork_function(postfork_setup)
for th in threading.enumerate():
@@ -2010,8 +2005,3 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf):
app = wrap_if_allowed(app, stack, SQLDebugMiddleware, args=(webapp, {}))
return app
def wrap_in_static(app, global_conf, plugin_frameworks=None, **local_conf):
urlmap, cache_time = galaxy.webapps.base.webapp.build_url_map(app, global_conf, local_conf)
return urlmap
+3
View File
@@ -13,6 +13,7 @@ import galaxy.model.mapping
import galaxy.webapps.base.webapp
from galaxy.util import asbool
from galaxy.util.properties import load_app_properties
from galaxy.webapps.base.webapp import build_url_map
from galaxy.webapps.util import wrap_if_allowed
log = logging.getLogger(__name__)
@@ -67,6 +68,8 @@ def app_factory(global_conf, load_app_kwds=None, **kwargs):
# Wrap the webapp in some useful middleware
if kwargs.get("middleware", True):
webapp = wrap_in_middleware(webapp, global_conf, app.application_stack, **kwargs)
if asbool(kwargs.get("static_enabled", True)):
webapp = wrap_if_allowed(webapp, app.application_stack, build_url_map, args=(global_conf,), kwargs=kwargs)
return webapp
+3
View File
@@ -15,6 +15,7 @@ import galaxy.webapps.base.webapp
from galaxy import util
from galaxy.util import asbool
from galaxy.util.properties import load_app_properties
from galaxy.webapps.base.webapp import build_url_map
from galaxy.webapps.util import wrap_if_allowed
log = logging.getLogger(__name__)
@@ -204,6 +205,8 @@ def app_factory(global_conf, load_app_kwds=None, **kwargs):
# Wrap the webapp in some useful middleware
if kwargs.get("middleware", True):
webapp = wrap_in_middleware(webapp, global_conf, app.application_stack, **kwargs)
if asbool(kwargs.get("static_enabled", True)):
webapp = wrap_if_allowed(webapp, app.application_stack, build_url_map, args=(global_conf,), kwargs=kwargs)
return webapp
+1 -1
View File
@@ -26,7 +26,7 @@ if [ $? -eq 0 ] ; then
fi
if [ -z "$TOOL_SHED_CONFIG_FILE" ]; then
TOOL_SHED_CONFIG_FILE=$(PYTHONPATH=lib python -c "from __future__ import print_function; from galaxy.util.properties import find_config_file; print(find_config_file(['tool_shed', 'tool_shed_wsgi']) or '')")
TOOL_SHED_CONFIG_FILE=$(PYTHONPATH=lib python -c "from __future__ import print_function; from galaxy.util.properties import find_config_file; print(find_config_file(['tool_shed', 'tool_shed_wsgi'], include_samples=True) or '')")
export TOOL_SHED_CONFIG_FILE
fi
+10 -4
View File
@@ -162,9 +162,11 @@ find_server() {
gunicorn_worker="galaxy.webapps.galaxy.workers.Worker"
;;
reports)
# TODO: don't override this var, and is this really the only way to configure the port?
GUNICORN_CMD_ARGS="--bind=localhost:9001"
# TODO: is this really the only way to configure the port?
GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--bind=localhost:9001"}
;;
tool_shed)
GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--bind=localhost:9009"}
esac
APP_WEBSERVER=${APP_WEBSERVER:-$default_webserver}
@@ -187,9 +189,13 @@ find_server() {
fi
server_args="$server_args $uwsgi_args"
elif [ "$APP_WEBSERVER" = "gunicorn" ]; then
export GUNICORN_CMD_ARGS="${GUNICORN_CMD_ARGS:-\"--bind=localhost:8080\"}"
run_server="gunicorn"
server_args="'galaxy.webapps.${server_app}.fast_factory:factory()' --pythonpath lib -k ${gunicorn_worker:-$default_gunicorn_worker} $gunicorn_args"
export GUNICORN_CMD_ARGS
if [ "$server_app" = "tool_shed" ]; then
server_args="'${server_app}.webapp.fast_factory:factory()' --pythonpath lib -k ${gunicorn_worker:-$default_gunicorn_worker} $gunicorn_args"
else
server_args="'galaxy.webapps.${server_app}.fast_factory:factory()' --pythonpath lib -k ${gunicorn_worker:-$default_gunicorn_worker} $gunicorn_args"
fi
if [ "$add_pid_arg" -eq 1 ]; then
server_args="$server_args --pid \"$PID_FILE\""
fi