Skip to content

Commit

Permalink
Merge branch 'release_24.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Jun 7, 2024
2 parents 4c4b62b + 0fb77c8 commit df19283
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 15 deletions.
6 changes: 6 additions & 0 deletions client/src/components/DataDialog/DataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface Props {
allowUpload?: boolean;
callback?: (results: Array<Record>) => void;
filterOkState?: boolean;
filterByTypeIds?: string[];
format?: string;
library?: boolean;
modalStatic?: boolean;
Expand All @@ -36,6 +37,7 @@ const props = withDefaults(defineProps<Props>(), {
allowUpload: true,
callback: () => {},
filterOkState: false,
filterByTypeIds: undefined,
format: "download",
library: true,
modalStatic: false,
Expand Down Expand Up @@ -96,6 +98,9 @@ function getHistoryUrl() {
if (props.filterOkState) {
queryString += "&q=state-eq&qv=ok";
}
if (props.filterByTypeIds && props.filterByTypeIds.length > 0) {
queryString += `&q=type_id-in&qv=${props.filterByTypeIds.join(",")}`;
}
return `${getAppRoot()}api/histories/${props.history}/contents?v=dev${queryString}`;
}
Expand Down Expand Up @@ -192,6 +197,7 @@ watch(
:disable-ok="!hasValue"
:fields="fields"
:items="items"
:total-items="items.length"
:modal-show="modalShow"
:multiple="multiple"
:options-show="optionsShow"
Expand Down
42 changes: 41 additions & 1 deletion client/src/components/Panels/VisualizationPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { faEye } from "@fortawesome/free-solid-svg-icons";
import { BAlert, BModal } from "bootstrap-vue";
import { storeToRefs } from "pinia";
import { computed, onMounted, type Ref, ref } from "vue";
import { useRouter } from "vue-router/composables";
Expand All @@ -22,14 +23,25 @@ interface Plugin {
target?: string;
}
interface Dataset {
id: string;
name: string;
}
interface CompatibleDatasetsResponse {
hdas: Dataset[];
}
const { currentHistoryId } = storeToRefs(useHistoryStore());
const router = useRouter();
const plugins: Ref<Array<Plugin>> = ref([]);
const query = ref("");
const isLoading = ref(true);
const currentPlugin: Ref<Plugin | null> = ref(null);
const compatibleDatasetIdKeys = ref<string[]>([]);
const showDataDialog = ref(false);
const showNoCompatibleDatasetsModal = ref(false);
const filteredPlugins = computed(() => {
const queryLower = query.value.toLowerCase();
Expand All @@ -51,11 +63,31 @@ function createVisualization(dataset: any) {
}
}
function selectVisualization(plugin: Plugin) {
async function selectVisualization(plugin: Plugin) {
currentPlugin.value = plugin;
compatibleDatasetIdKeys.value = await getCompatibleDatasetsInCurrentHistory();
if (compatibleDatasetIdKeys.value.length === 0) {
showNoCompatibleDatasetsModal.value = true;
return;
}
showDataDialog.value = true;
}
/**
* Get compatible datasets in the current history for the selected visualization.
* @returns {Promise<string[]>} List of compatible datasets as "type-id" strings. In this case, type will be always "dataset".
*/
async function getCompatibleDatasetsInCurrentHistory(): Promise<string[]> {
if (!currentPlugin.value || !currentHistoryId.value) {
return [];
}
const result = (await urlData({
url: `/api/plugins/${currentPlugin.value.name}`,
params: { history_id: currentHistoryId.value },
})) as CompatibleDatasetsResponse;
return result.hdas.map((dataset: Dataset) => `dataset-${dataset.id}`);
}
async function getPlugins() {
plugins.value = await urlData({ url: "/api/plugins" });
isLoading.value = false;
Expand Down Expand Up @@ -97,8 +129,16 @@ onMounted(() => {
format=""
:history="currentHistoryId"
:filter-ok-state="true"
:filter-by-type-ids="compatibleDatasetIdKeys"
@onOk="createVisualization"
@onCancel="showDataDialog = false" />
<BModal v-model="showNoCompatibleDatasetsModal" title="No compatible datasets found" title-tag="h2" ok-only>
<p v-localize>
No datasets found in your current history that are compatible with
<b>{{ currentPlugin?.name ?? "this visualization" }}</b
>. Please upload a compatible dataset or select a different visualization.
</p>
</BModal>
</ActivityPanel>
</template>

Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/editor/config/editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<data_sources>
<data_source>
<model_class>HistoryDatasetAssociation</model_class>
<test type="isinstance" test_attr="datatype" result_type="datatype">data.Data</test>
<test type="isinstance" test_attr="datatype" result_type="datatype">data.Text</test>
<to_param param_attr="id">dataset_id</to_param>
</data_source>
</data_sources>
Expand Down
9 changes: 6 additions & 3 deletions lib/galaxy/jobs/runners/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from galaxy import model
from galaxy.jobs.runners.drmaa import DRMAAJobRunner
from galaxy.util import commands
from galaxy.util import (
commands,
unicodify,
)
from galaxy.util.custom_logging import get_logger

log = get_logger(__name__)
Expand Down Expand Up @@ -212,12 +215,12 @@ def __check_memory_limit(self, efile_path):
"""
try:
log.debug("Checking %s for exceeded memory message from SLURM", efile_path)
with open(efile_path) as f:
with open(efile_path, "rb") as f:
if os.path.getsize(efile_path) > 2048:
f.seek(-2048, os.SEEK_END)
f.readline()
for line in f.readlines():
stripped_line = line.strip()
stripped_line = unicodify(line.strip())
if stripped_line == SLURM_MEMORY_LIMIT_EXCEEDED_MSG:
return OUT_OF_MEMORY_MSG
elif any(_ in stripped_line for _ in SLURM_MEMORY_LIMIT_EXCEEDED_PARTIAL_WARNINGS):
Expand Down
6 changes: 2 additions & 4 deletions lib/galaxy/webapps/galaxy/services/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,7 @@ def get_index(
for key, value in user_dict.items():
if key in expose_keys:
limited_user[key] = value
user = LimitedUserModel(**limited_user)
rval.append(LimitedUserModel(**limited_user))
else:
user = UserModel(**user_dict)

rval.append(user)
rval.append(UserModel(**user_dict))
return rval
3 changes: 3 additions & 0 deletions lib/tool_shed/util/repository_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ def create_repository(
dir=app.config.file_path,
prefix=f"{repository.user.username}-{repository.name}",
)
# Created directory is readable, writable, and searchable only by the creating user ID,
# but we need to make it world-readable so non-shed user can serve files (e.g. hgweb run as different user).
os.chmod(repository_path, util.RWXR_XR_X)
# Create the local repository.
init_repository(repo_path=repository_path)
# Create a .hg/hgrc file for the local repository.
Expand Down
15 changes: 9 additions & 6 deletions test/integration/test_users.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from typing import ClassVar
from typing import (
ClassVar,
Set,
)

from galaxy_test.driver import integration_util

USER_SUMMARY_KEYS = set(["model_class", "id", "email", "username", "deleted", "active", "last_password_change"])
USER_SUMMARY_KEYS: Set[str] = {"model_class", "id", "email", "username", "deleted", "active", "last_password_change"}


class UsersIntegrationCase(integration_util.IntegrationTestCase):
expose_user_name: ClassVar[bool]
expose_user_email: ClassVar[bool]
expected_regular_user_list_count: ClassVar[int]
expected_limited_user_keys: ClassVar[set]
expected_limited_user_keys: ClassVar[Set[str]]

@classmethod
def handle_galaxy_config_kwds(cls, config):
Expand Down Expand Up @@ -57,7 +60,7 @@ class TestExposeUsersIntegration(UsersIntegrationCase):
expose_user_email = True

# Since we allow to expose user information, all users are returned.
expected_limited_user_keys = set(["id", "username", "email"])
expected_limited_user_keys = {"id", "username", "email"}
expected_regular_user_list_count = 3


Expand All @@ -67,7 +70,7 @@ class TestExposeOnlyUserNameIntegration(UsersIntegrationCase):

# When only username is exposed, only that field is returned in the user list.
# Since we are exposing user information, all users are returned.
expected_limited_user_keys = set(["id", "username"])
expected_limited_user_keys = {"id", "username"}
expected_regular_user_list_count = 3


Expand All @@ -77,7 +80,7 @@ class TestExposeOnlyUserEmailIntegration(UsersIntegrationCase):

# When only email is exposed, only that field is returned in the user list.
# Since we are exposing user information, all users are returned.
expected_limited_user_keys = set(["id", "email"])
expected_limited_user_keys = {"id", "email"}
expected_regular_user_list_count = 3


Expand Down

0 comments on commit df19283

Please sign in to comment.