Skip to content

Commit 48841bd

Browse files
committed
Merge branch 'release_25.0' into dev
2 parents ab64350 + c254d6c commit 48841bd

File tree

5 files changed

+34
-10
lines changed

5 files changed

+34
-10
lines changed

lib/galaxy/model/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7093,6 +7093,9 @@ def populated_optimized(self):
70937093

70947094
return self._populated_optimized
70957095

7096+
def expire_populated_state(self):
7097+
required_object_session(self).expire(self, ("populated_state",))
7098+
70967099
@property
70977100
def allow_implicit_mapping(self):
70987101
return self.collection_type != "record"

lib/galaxy/model/store/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ class SessionlessContext:
224224
def __init__(self) -> None:
225225
self.objects: dict[type, dict] = defaultdict(dict)
226226

227+
def execute(self, query: Any, *args, **kwargs) -> Any:
228+
pass
229+
230+
def delete(self, obj: model.RepresentById) -> None:
231+
self.objects[obj.__class__].pop(obj.id, None)
232+
233+
def scalars(self, query: Any, *args, **kwargs) -> Any:
234+
pass
235+
227236
def commit(self) -> None:
228237
pass
229238

lib/galaxy/model/tags.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import (
44
Optional,
55
TYPE_CHECKING,
6+
Union,
67
)
78

89
from sqlalchemy.exc import IntegrityError
@@ -26,6 +27,7 @@
2627

2728
if TYPE_CHECKING:
2829
from galaxy.model import User
30+
from galaxy.model.store import SessionlessContext
2931

3032
log = logging.getLogger(__name__)
3133

@@ -43,7 +45,9 @@ class TagHandler:
4345
Manages CRUD operations related to tagging objects.
4446
"""
4547

46-
def __init__(self, sa_session: scoped_session, galaxy_session: Optional[GalaxySession] = None) -> None:
48+
def __init__(
49+
self, sa_session: Union[scoped_session, "SessionlessContext"], galaxy_session: Optional[GalaxySession] = None
50+
) -> None:
4751
self.sa_session = sa_session
4852
# Minimum tag length.
4953
self.min_tag_len = 1
@@ -61,7 +65,10 @@ def __init__(self, sa_session: scoped_session, galaxy_session: Optional[GalaxySe
6165

6266
def create_tag_handler_session(self, galaxy_session: Optional[GalaxySession]):
6367
# Creates a transient tag handler that avoids repeated flushes
64-
return GalaxyTagHandlerSession(self.sa_session, galaxy_session=galaxy_session)
68+
if isinstance(self.sa_session, scoped_session):
69+
return GalaxyTagHandlerSession(self.sa_session, galaxy_session=galaxy_session)
70+
else:
71+
return self
6572

6673
def add_tags_from_list(self, user, item, new_tags_list, flush=True):
6774
new_tags_set = set(new_tags_list)
@@ -324,7 +331,7 @@ def _get_tag(self, tag_name):
324331
def _create_tag_instance(self, tag_name):
325332
# For good performance caller should first check if there's already an appropriate tag
326333
tag = Tag(type=0, name=tag_name)
327-
if not self.sa_session:
334+
if not isinstance(self.sa_session, scoped_session):
328335
return tag
329336
Session = sessionmaker(self.sa_session.bind)
330337
with Session() as separate_session:

lib/galaxy/workflow/run.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,14 +503,18 @@ def replacement_for_connection(self, connection: "WorkflowStepConnection", is_da
503503
# If we are not waiting for elements, there was some
504504
# problem creating the collection. Collection will never
505505
# be populated.
506-
raise modules.FailWorkflowEvaluation(
507-
why=InvocationFailureCollectionFailed(
508-
reason=FailureReason.collection_failed,
509-
hdca_id=replacement.id,
510-
workflow_step_id=connection.input_step_id,
511-
dependent_workflow_step_id=output_step_id,
506+
# We want to be certain of this however, so refresh attribute ...
507+
replacement.collection.expire_populated_state()
508+
# ... and repeat check to avoid race condition
509+
if not replacement.collection.populated:
510+
raise modules.FailWorkflowEvaluation(
511+
why=InvocationFailureCollectionFailed(
512+
reason=FailureReason.collection_failed,
513+
hdca_id=replacement.id,
514+
workflow_step_id=connection.input_step_id,
515+
dependent_workflow_step_id=output_step_id,
516+
)
512517
)
513-
)
514518

515519
delayed_why = f"dependent collection [{replacement.id}] not yet populated with datasets"
516520
raise modules.DelayedWorkflowEvaluation(why=delayed_why)

test/integration/test_pulsar_embedded_extended_metadata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ def handle_galaxy_config_kwds(cls, config):
3131
"metadata_bam",
3232
"job_properties",
3333
"from_work_dir_glob",
34+
"gx_group_tag",
3435
]
3536
)

0 commit comments

Comments
 (0)