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 3, 2024
2 parents ef294f9 + 2c4ad24 commit 4e254a6
Show file tree
Hide file tree
Showing 42 changed files with 117 additions and 44 deletions.
56 changes: 39 additions & 17 deletions client/src/components/Workflow/Editor/Actions/stepActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,34 +423,46 @@ export function useStepActions(
}
}

interface ChangeValueOrCreateActionOptions<K extends keyof Step> {
step: Step;
key: K;
value: Step[K];
name?: string;
actionConstructor?: () => LazyMutateStepAction<K>;
keepActionAlive?: boolean;
timeout?: number;
}

/**
* Mutates a queued lazy action, if a matching one exists,
* otherwise creates a new lazy action ans queues it.
*/
function changeValueOrCreateAction<K extends keyof Step>(
step: Step,
key: K,
value: Step[K],
name?: string,
actionConstructor?: () => LazyMutateStepAction<K>
options: ChangeValueOrCreateActionOptions<K>
): InstanceType<typeof LazyMutateStepAction<K>> {
const { step, key, value, name, keepActionAlive, timeout } = options;
const actionForKey = actionForIdAndKey(step.id, key);

if (actionForKey) {
actionForKey.changeValue(value);

if (keepActionAlive) {
undoRedoStore.setLazyActionTimeout(timeout);
}

return actionForKey;
} else {
actionConstructor =
actionConstructor ?? (() => new LazyMutateStepAction(stepStore, step.id, key, step[key], value));
const actionConstructor =
options.actionConstructor ??
(() => new LazyMutateStepAction(stepStore, step.id, key, step[key], value));

const action = actionConstructor();

if (name) {
action.name = name;
}

undoRedoStore.applyLazyAction(action);
undoRedoStore.applyLazyAction(action, timeout);

action.onUndoRedo = () => {
stateStore.activeNodeId = step.id;
Expand All @@ -462,11 +474,11 @@ export function useStepActions(
}

function setPosition(step: Step, position: NonNullable<Step["position"]>) {
changeValueOrCreateAction(step, "position", position, "change step position");
changeValueOrCreateAction({ step, key: "position", value: position, name: "change step position" });
}

function setAnnotation(step: Step, annotation: Step["annotation"]) {
changeValueOrCreateAction(step, "annotation", annotation, "modify step annotation");
changeValueOrCreateAction({ step, key: "annotation", value: annotation, name: "modify step annotation" });
}

function setOutputLabel(
Expand All @@ -478,18 +490,28 @@ export function useStepActions(
const actionConstructor = () =>
new LazySetOutputLabelAction(stepStore, stateStore, step.id, fromLabel, toLabel, workflowOutputs);

changeValueOrCreateAction(
changeValueOrCreateAction({
step,
"workflow_outputs",
workflowOutputs,
"modify step output label",
actionConstructor
);
key: "workflow_outputs",
value: workflowOutputs,
name: "modify step output label",
actionConstructor,
keepActionAlive: true,
timeout: 2000,
});
}

function setLabel(step: Step, label: Step["label"]) {
const actionConstructor = () => new LazySetLabelAction(stepStore, stateStore, step.id, step.label, label);
changeValueOrCreateAction(step, "label", label, "modify step label", actionConstructor);
changeValueOrCreateAction({
step,
key: "label",
value: label,
name: "modify step label",
actionConstructor,
keepActionAlive: true,
timeout: 2000,
});
}

const { refresh } = useRefreshFromStore();
Expand Down
2 changes: 1 addition & 1 deletion client/src/stores/undoRedoStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const useUndoRedoStore = defineScopedStore("undoRedoStore", () => {
}
}

function setLazyActionTimeout(timeout: number) {
function setLazyActionTimeout(timeout = 1000) {
clearTimeout(lazyActionTimeout);
lazyActionTimeout = setTimeout(() => flushLazyAction(), timeout);
}
Expand Down
11 changes: 9 additions & 2 deletions client/src/utils/mountVueComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

import BootstrapVue from "bootstrap-vue";
import { iconPlugin, localizationPlugin, vueRxShortcutPlugin } from "components/plugins";
import { createPinia, PiniaVuePlugin } from "pinia";
import Vue from "vue";

// Load Pinia
Vue.use(PiniaVuePlugin);

// Bootstrap components
Vue.use(BootstrapVue);

Expand All @@ -18,15 +22,18 @@ Vue.use(vueRxShortcutPlugin);
// font-awesome svg icon registration/loading
Vue.use(iconPlugin);

// Create Pinia
const pinia = createPinia();

export const mountVueComponent = (ComponentDefinition) => {
const component = Vue.extend(ComponentDefinition);
return (propsData, el) => new component({ propsData, el });
return (propsData, el) => new component({ propsData, el, pinia });
};

export const replaceChildrenWithComponent = (el, ComponentDefinition, propsData = {}) => {
const container = document.createElement("div");
el.replaceChildren(container);
const component = Vue.extend(ComponentDefinition);
const mountFn = (propsData, el) => new component({ propsData, el });
const mountFn = (propsData, el) => new component({ propsData, el, pinia });
return mountFn(propsData, container);
};
5 changes: 5 additions & 0 deletions lib/galaxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
jobs,
tools,
)
from galaxy.carbon_emissions import get_carbon_intensity_entry
from galaxy.celery.base_task import (
GalaxyTaskBeforeStart,
GalaxyTaskBeforeStartUserRateLimitPostgres,
Expand Down Expand Up @@ -556,6 +557,10 @@ def __init__(self, configure_logging=True, use_converters=True, use_display_appl
self.application_stack = self._register_singleton(ApplicationStack, application_stack_instance(app=self))
if configure_logging:
config.configure_logging(self.config, self.application_stack.facts)
# Carbon emissions configuration
carbon_intensity_entry = get_carbon_intensity_entry(self.config.geographical_server_location_code)
self.carbon_intensity = carbon_intensity_entry["carbon_intensity"]
self.geographical_server_location_name = carbon_intensity_entry["location_name"]
# Initialize job metrics manager, needs to be in place before
# config so per-destination modifications can be made.
self.job_metrics = self._register_singleton(
Expand Down
8 changes: 0 additions & 8 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import yaml

from galaxy.carbon_emissions import get_carbon_intensity_entry
from galaxy.config.schema import AppSchema
from galaxy.exceptions import ConfigurationError
from galaxy.util import (
Expand Down Expand Up @@ -700,15 +699,13 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):

allowed_origin_hostnames: List[str]
builds_file_path: str
carbon_intensity: float
container_resolvers_config_file: str
database_connection: str
drmaa_external_runjob_script: str
email_from: Optional[str]
enable_tool_shed_check: bool
galaxy_data_manager_data_path: str
galaxy_infrastructure_url: str
geographical_server_location_name: str
hours_between_check: int
integrated_tool_panel_config: str
involucro_path: str
Expand Down Expand Up @@ -814,11 +811,6 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None:
else:
self.version_extra = extra_info

# Carbon emissions configuration
carbon_intensity_entry = get_carbon_intensity_entry(kwargs.get("geographical_server_location_code", ""))
self.carbon_intensity = carbon_intensity_entry["carbon_intensity"]
self.geographical_server_location_name = carbon_intensity_entry["location_name"]

# Database related configuration
self.check_migrate_databases = string_as_bool(kwargs.get("check_migrate_databases", True))
if not self.database_connection: # Provide default if not supplied by user
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/managers/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def _config_is_truthy(item, key, **context):
"interactivetools_enable": _use_config,
"aws_estimate": _use_config,
"carbon_emission_estimates": _defaults_to(True),
"carbon_intensity": _use_config,
"geographical_server_location_name": _use_config,
"carbon_intensity": lambda item, key, **context: self.app.carbon_intensity,
"geographical_server_location_name": lambda item, key, **context: self.app.geographical_server_location_name,
"geographical_server_location_code": _use_config,
"power_usage_effectiveness": _use_config,
"message_box_content": _use_config,
Expand Down
2 changes: 2 additions & 0 deletions lib/galaxy/structured_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ class MinimalApp(BasicSharedApp):

class MinimalManagerApp(MinimalApp):
# Minimal App that is sufficient to run Celery tasks
carbon_intensity: float
file_sources: ConfiguredFileSources
genome_builds: GenomeBuilds
geographical_server_location_name: str
dataset_collection_manager: "DatasetCollectionManager"
tool_data_tables: "ToolDataTableManager"
history_manager: "HistoryManager"
Expand Down
2 changes: 0 additions & 2 deletions packages/app/pytest.ini

This file was deleted.

1 change: 1 addition & 0 deletions packages/app/pytest.ini
1 change: 1 addition & 0 deletions packages/auth/pytest.ini
1 change: 1 addition & 0 deletions packages/config/pytest.ini
1 change: 1 addition & 0 deletions packages/data/pytest.ini
1 change: 1 addition & 0 deletions packages/files/pytest.ini
1 change: 1 addition & 0 deletions packages/job_execution/pytest.ini
1 change: 1 addition & 0 deletions packages/job_metrics/pytest.ini
1 change: 1 addition & 0 deletions packages/meta/pytest.ini
1 change: 1 addition & 0 deletions packages/navigation/pytest.ini
1 change: 1 addition & 0 deletions packages/objectstore/pytest.ini
6 changes: 6 additions & 0 deletions packages/package-pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pytest]
# Prevent execution of alembic/env.py at test collection stage (alembic.context not set).
# Also ignore functional tests (galaxy_test/ and tool_shed/test/).
addopts = --doctest-modules --ignore=galaxy/model/migrations/alembic/ --ignore=galaxy/tools/bundled/ --ignore=galaxy_test/ --ignore=tool_shed/test/ --ignore=tool_shed/webapp/model/migrations/alembic/ --doctest-continue-on-failure --verbosity=1
asyncio_mode = auto
log_level = DEBUG
1 change: 1 addition & 0 deletions packages/schema/pytest.ini
1 change: 1 addition & 0 deletions packages/selenium/pytest.ini
5 changes: 1 addition & 4 deletions packages/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ while read -r package_dir || [ -n "$package_dir" ]; do # https://stackoverflow.
else
marker_args=()
fi
# Prevent execution of alembic/env.py at test collection stage (alembic.context not set)
# Also ignore functional tests (galaxy_test/ and tool_shed/test/).
unit_extra=(--doctest-modules --ignore=galaxy/model/migrations/alembic/ --ignore=galaxy_test/ --ignore=tool_shed/test/ --ignore=tool_shed/webapp/model/migrations/alembic/ "${marker_args[@]}")
# Ignore exit code 5 (no tests ran)
pytest "${unit_extra[@]}" . || test $? -eq 5
pytest "${marker_args[@]}" . || test $? -eq 5
if [ $FOR_PULSAR -eq 0 ]; then
make mypy
fi
Expand Down
1 change: 1 addition & 0 deletions packages/test_api/pytest.ini
1 change: 1 addition & 0 deletions packages/test_base/pytest.ini
1 change: 1 addition & 0 deletions packages/test_driver/pytest.ini
2 changes: 0 additions & 2 deletions packages/test_driver/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ install_requires =
galaxy-util
galaxy-web-apps
pytest
graphene-sqlalchemy==3.0.0rc1 # these are only needed by tool shed - which we've split out but the test driver loads
starlette-graphene3
packages = find:
python_requires = >=3.8

Expand Down
1 change: 1 addition & 0 deletions packages/test_selenium/pytest.ini
1 change: 1 addition & 0 deletions packages/tool_shed/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include *.rst *.txt LICENSE */py.typed
graft tool_shed/webapp/templates/
1 change: 1 addition & 0 deletions packages/tool_shed/pytest.ini
25 changes: 25 additions & 0 deletions packages/tool_shed/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,33 @@ version = 23.2.dev0
[options]
include_package_data = True
install_requires =
galaxy-app
galaxy-auth
galaxy-config
galaxy-data
galaxy-util
galaxy-web-framework
galaxy-web-stack
galaxy-web-apps
a2wsgi
alembic
fastapi>=0.101.0
graphene
graphene-sqlalchemy>=3.0.0rc1
graphql-core
Mako
MarkupSafe
mercurial
Paste
pydantic>=2,!=2.6.0,!=2.6.1
Routes
SQLAlchemy>=2.0,<2.1
starlette
starlette-context
starlette-graphene3
typing-extensions
WebOb
Whoosh
packages = find:
python_requires = >=3.8

Expand Down
1 change: 1 addition & 0 deletions packages/tool_util/pytest.ini
1 change: 1 addition & 0 deletions packages/tours/pytest.ini
1 change: 1 addition & 0 deletions packages/util/pytest.ini
2 changes: 0 additions & 2 deletions packages/web_apps/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ prune galaxy/webapps/base/static/plugins/
exclude galaxy/webapps/base/static/style/base.css
exclude galaxy/webapps/base/static/welcome.html
graft galaxy/webapps/base/templates/
include tool_shed/webapp/model/migrate/migrate.cfg
graft tool_shed/webapp/templates/

This file was deleted.

1 change: 1 addition & 0 deletions packages/web_apps/pytest.ini
2 changes: 0 additions & 2 deletions packages/web_apps/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ install_requires =
importlib-resources;python_version<'3.9'
Mako
MarkupSafe
mercurial
Paste
pydantic>=2,!=2.6.0,!=2.6.1
PyJWT
Expand All @@ -67,7 +66,6 @@ install_requires =
uvicorn
uvloop
WebOb
Whoosh
packages = find:
python_requires = >=3.8

Expand Down
1 change: 1 addition & 0 deletions packages/web_framework/pytest.ini
1 change: 1 addition & 0 deletions packages/web_stack/pytest.ini
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ fastapi-slim = ">=0.111.0"
fs = "*"
future = ">=1.0.0" # Python 3.12 support
galaxy_sequence_utils = "*"
graphene-sqlalchemy = "3.0.0rc1" # need a beta release to be compat. with starlette plugin
graphene = "*"
graphene-sqlalchemy = ">=3.0.0rc1" # need a beta release to be compat. with starlette plugin
graphql-core = "*"
gravity = ">=1.0.4"
gunicorn = "*"
gxformat2 = "*"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4e254a6

Please sign in to comment.