Skip to content

Commit

Permalink
Merge branch 'release_24.0' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed May 20, 2024
2 parents 9d2a45f + d613130 commit e2f5703
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/src/components/PageDisplay/PageHtml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
if (content) {
const vDom = document.createElement("div");
vDom.innerHTML = content;
const children = vDom.children;
const children = Array.from(vDom.children);
children.forEach((child) => {
if (child.classList.contains("embedded-item")) {
const splitId = child.id.split("-");
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Tool/ToolForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="currentUser && currentHistoryId">
<div v-if="currentUser && currentHistoryId && isConfigLoaded">
<b-alert :show="messageShow" :variant="messageVariant">
{{ messageText }}
</b-alert>
Expand Down
13 changes: 10 additions & 3 deletions client/src/components/Tool/ToolSuccess.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import { BAlert } from "bootstrap-vue";
import { computed, onMounted } from "vue";
import { useRouter } from "vue-router/composables";
import { useConfig } from "@/composables/config";
import { useJobStore } from "@/stores/jobStore";
import LoadingSpan from "../LoadingSpan.vue";
import ToolRecommendation from "../ToolRecommendation.vue";
import ToolSuccessMessage from "./ToolSuccessMessage.vue";
import Webhook from "@/components/Common/Webhook.vue";
Expand All @@ -31,10 +33,15 @@ onMounted(() => {

<template>
<section>
<div v-if="jobResponse.produces_entry_points">
<ToolEntryPoints v-for="job in jobResponse.jobs" :key="job.id" :job-id="job.id" />
<BAlert v-if="!jobResponse" variant="info" show>
<LoadingSpan message="Waiting on a job response" />
</BAlert>
<div v-else>
<div v-if="jobResponse?.produces_entry_points">
<ToolEntryPoints v-for="job in jobResponse.jobs" :key="job.id" :job-id="job.id" />
</div>
<ToolSuccessMessage :job-response="jobResponse" :tool-name="toolName" />
</div>
<ToolSuccessMessage :job-response="jobResponse" :tool-name="toolName" />
<Webhook type="tool" :tool-id="jobDef.tool_id" />
<ToolRecommendation v-if="showRecommendation" :tool-id="jobDef.tool_id" />
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function onConfirmCleanupSelected(selectedItems: CleanableItem[]) {
</b-alert>
</b-row>
<b-row class="justify-content-md-center mb-5">
<b-alert v-if="config.enable_quotas" show>
<b-alert v-if="config?.enable_quotas" show>
{{ localize("The storage manager only shows elements that count towards your disk quota.") }}
<b-link :href="config.quota_url" target="_blank">{{ localize("Learn more") }}</b-link>
</b-alert>
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/files/sources/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)

from galaxy.files import OptionalUserContext
from galaxy.exceptions import AuthenticationRequired
from galaxy.files.sources import (
AnyRemoteEntry,
DEFAULT_SCHEME,
Expand Down Expand Up @@ -434,6 +435,9 @@ def _get_request_headers(self, user_context: OptionalUserContext):
return headers

def _ensure_response_has_expected_status_code(self, response, expected_status_code: int):
if response.status_code == 403:
record_url = response.url.replace("/api", "").replace("/files", "")
raise AuthenticationRequired(f"Please make sure you have the necessary permissions to access: {record_url}")
if response.status_code != expected_status_code:
error_message = self._get_response_error_message(response)
raise Exception(
Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/files/uris.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from galaxy.exceptions import (
AdminRequiredException,
ConfigDoesNotAllowException,
RequestParameterInvalidException,
)
from galaxy.files import (
ConfiguredFileSources,
Expand Down Expand Up @@ -125,7 +126,11 @@ def validate_non_local(uri: str, ip_allowlist: List[IpAllowedListEntryT]) -> str
# safe to log out, no credentials/request path, just an IP + port
log.debug("parsed url %s, port: %s", parsed_url, port)
# Call getaddrinfo to resolve hostname into tuples containing IPs.
addrinfo = socket.getaddrinfo(parsed_url, port)
try:
addrinfo = socket.getaddrinfo(parsed_url, port)
except socket.gaierror as e:
log.debug("Could not resolve url '%': %'", url, e)
raise RequestParameterInvalidException(f"Could not verify url '{url}'.")
# Get the IP addresses that this entry resolves to (uniquely)
# We drop:
# AF_* family: It will resolve to AF_INET or AF_INET6, getaddrinfo(3) doesn't even mention AF_UNIX,
Expand Down
3 changes: 0 additions & 3 deletions lib/galaxy/job_execution/actions/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from markupsafe import escape

from galaxy.model import PostJobActionAssociation
from galaxy.model.base import transaction
from galaxy.util import send_mail
from galaxy.util.custom_logging import get_logger

Expand Down Expand Up @@ -370,8 +369,6 @@ def execute(cls, app, sa_session, action, job, replacement_dict, final_job_state
# POTENTIAL ISSUES: When many outputs are being finish()ed
# concurrently, sometimes non-terminal steps won't be cleaned up
# because of the lag in job state updates.
with transaction(sa_session):
sa_session.commit()
if not job.workflow_invocation_step:
log.debug("This job is not part of a workflow invocation, delete intermediates aborted.")
return
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/jobs/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ def __handle_waiting_jobs(self):
self.sa_session.add(dataset_assoc.dataset.dataset)
self.sa_session.add(job)
elif job_state == JOB_ERROR:
log.error("(%d) Error checking job readiness" % job.id)
# A more informative message is shown wherever the job state is set to error
pass
else:
log.error("(%d) Job in unknown state '%s'" % (job.id, job_state))
new_waiting_jobs.append(job.id)
Expand Down
17 changes: 12 additions & 5 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,9 @@ def to_text(self, value):

# Code from CWL branch to massage in order to be shared across tools and workflows,
# and for CWL artifacts as well as Galaxy ones.
def raw_to_galaxy(app: "MinimalApp", history: "History", as_dict_value: Dict[str, Any]) -> "HistoryItem":
def raw_to_galaxy(
app: "MinimalApp", history: "History", as_dict_value: Dict[str, Any], commit: bool = True
) -> "HistoryItem":
object_class = as_dict_value["class"]
if object_class == "File":
# TODO: relative_to = "/"
Expand Down Expand Up @@ -2728,7 +2730,8 @@ def raw_to_galaxy(app: "MinimalApp", history: "History", as_dict_value: Dict[str
app.model.session.add(primary_data)
history.stage_addition(primary_data)
history.add_pending_items()
app.model.session.flush()
if commit:
app.model.session.commit()
return primary_data
else:
name = as_dict_value.get("name")
Expand All @@ -2740,14 +2743,16 @@ def raw_to_galaxy(app: "MinimalApp", history: "History", as_dict_value: Dict[str
name=name,
collection=collection,
)
app.model.session.add(hdca)

def write_elements_to_collection(has_elements, collection_builder):
element_dicts = has_elements.get("elements")
for element_dict in element_dicts:
element_class = element_dict["class"]
identifier = element_dict["identifier"]
if element_class == "File":
hda = raw_to_galaxy(app, history, element_dict)
# Don't commit for inner elements
hda = raw_to_galaxy(app, history, element_dict, commit=False)
collection_builder.add_dataset(identifier, hda)
else:
subcollection_builder = collection_builder.get_level(identifier)
Expand All @@ -2756,8 +2761,10 @@ def write_elements_to_collection(has_elements, collection_builder):
collection_builder = builder.BoundCollectionBuilder(collection)
write_elements_to_collection(as_dict_value, collection_builder)
collection_builder.populate()
app.model.session.add(hdca)
app.model.session.flush()
history.stage_addition(hdca)
history.add_pending_items()
if commit:
app.model.session.commit()
return hdca


Expand Down

0 comments on commit e2f5703

Please sign in to comment.