Commit Graph
37590 Commits
Author SHA1 Message Date
mvdbeek 74766a3fb5 Merge branch 'release_24.0' into dev 2024-03-11 12:02:17 +01:00
mvdbeek 3dbc2c6760 Merge branch 'release_23.2' into release_24.0 2024-03-11 11:55:56 +01:00
Marius van den Beek b73d9e29fb Merge pull request #17641 from bernt-matthias/yaml-nested-assertions
[23.2] Yaml nested assertions: fix parsing
2024-03-11 11:49:59 +01:00
Marius van den Beek 4e18d82b9e Merge pull request #17628 from mvdbeek/add_basic_model_import_validation
[24.0] Add basic model import attribute validation
2024-03-11 11:44:36 +01:00
Marius van den Beek f3239d0f68 Merge pull request #17646 from mvdbeek/task_uuid_required
[24.0] Don't index tasks without task_uuid
2024-03-11 11:42:40 +01:00
Marius van den Beek 8697be0cf5 Merge pull request #17634 from ahmedhamidawan/fix_tool_panel_workflow_bugs
[23.2] Fix tool panel workflow and favorites button bugs
2024-03-11 11:39:20 +01:00
Matthias Bernt 9a17a04785 fix: nested assertions must be list 2024-03-08 19:32:04 +01:00
Martin Cech aef5fdff91 Merge pull request #17645 from mvdbeek/no_500_anon_api_users
[24.0] Don't fail for anon /api/users request
2024-03-08 18:39:03 +01:00
mvdbeek 6c77dd4123 Merge branch 'release_23.2' into release_24.0 2024-03-08 16:41:58 +01:00
mvdbeek a219b63808 Don't index tasks without task_uuid
There's a brief window where we've committed a task to the database
but it doesn't have a task uuid yet
(https://github.com/galaxyproject/galaxy/blob/474a0536fadcddc1f6b328955e0cda1d6a281787/lib/galaxy/webapps/galaxy/services/histories.py#L397-L408).

This fails response validation as in
https://sentry.galaxyproject.org/share/issue/e0d4080044754c8aa60dd6bd8667dfcf/:

```

ExceptionGroup: unhandled errors in a TaskGroup
  File "starlette/_utils.py", line 87, in collapse_excgroups
    yield
  File "starlette/middleware/base.py", line 190, in __call__
    async with anyio.create_task_group() as task_group:
  File "anyio/_backends/_asyncio.py", line 678, in __aexit__
    raise BaseExceptionGroup(
ValidationError: 1 validation error for ExportTaskListResponse
0.task_uuid
  UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/uuid_type
  File "starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "starlette_context/middleware/raw_middleware.py", line 92, in __call__
    await self.app(scope, receive, send_wrapper)
  File "starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
  File "galaxy/webapps/galaxy/fast_app.py", line 108, in add_x_frame_options
    response = await call_next(request)
  File "starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "starlette/routing.py", line 74, in app
    response = await func(request)
  File "fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
  File "fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "starlette/concurrency.py", line 42, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
  File "anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "galaxy/webapps/galaxy/api/histories.py", line 503, in index_exports
    return ExportTaskListResponse(root=exports)
```
2024-03-08 16:28:24 +01:00
mvdbeek cdde21604f Add basic model import attribute validation
And coerce invalid `deleted` dataset state to `discarded`.
2024-03-08 15:27:36 +01:00
mvdbeek 71741fc8ab Merge branch 'release_23.1' into release_23.2 2024-03-08 15:09:13 +01:00
Marius van den Beek 74c8ded7d5 Merge pull request #17640 from mvdbeek/no_500_anon_invocations
[24.0] Prevent 500 for anon /api/invocations
2024-03-08 15:07:37 +01:00
Matthias Bernt df7c2af45c typing fix 2024-03-08 12:52:14 +01:00
mvdbeek 299d80da0b Don't fail for anon /api/users request 2024-03-08 12:46:55 +01:00
Matthias Bernt 2a7cce03f3 yaml parsing: fix nested assertions
were forgotten to be implemented
2024-03-08 12:46:17 +01:00
mvdbeek 0aff259b18 Prevent 500 for anon /api/invocations
Fixes:
```
ExceptionGroup: unhandled errors in a TaskGroup
  File "starlette/_utils.py", line 87, in collapse_excgroups
    yield
  File "starlette/middleware/base.py", line 190, in __call__
    async with anyio.create_task_group() as task_group:
  File "anyio/_backends/_asyncio.py", line 678, in __aexit__
    raise BaseExceptionGroup(
AttributeError: 'NoneType' object has no attribute 'id'
  File "starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "starlette_context/middleware/raw_middleware.py", line 92, in __call__
    await self.app(scope, receive, send_wrapper)
  File "starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
  File "galaxy/webapps/galaxy/fast_app.py", line 108, in add_x_frame_options
    response = await call_next(request)
  File "starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "starlette/routing.py", line 74, in app
    response = await func(request)
  File "fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
  File "fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "starlette/concurrency.py", line 42, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
  File "anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "galaxy/webapps/galaxy/api/workflows.py", line 1316, in index_invocations
    invocations, total_matches = self.invocations_service.index(trans, invocation_payload, serialization_params)
  File "galaxy/webapps/galaxy/services/invocations.py", line 111, in index
    user_id = trans.user.id
```
from https://sentry.galaxyproject.org/share/issue/7d75e948d2db45039544435f1c4e1eda/
2024-03-08 12:20:41 +01:00
mvdbeek 61545f244a Make WorkflowInput label, value and uuid optional
Fixes:
```
ValidationError
2 validation errors for StoredWorkflowDetailed
inputs.0.uuid
  UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/uuid_type
inputs.1.uuid
  UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/uuid_type
```
https://sentry.galaxyproject.org/share/issue/dd0fa7dec206415f82eefb876de1ca1e/
2024-03-08 12:07:18 +01:00
mvdbeek 81086bf233 Fix DataResult type
None isn't valid for `List[Any]`.
Fixes:
```
ValidationError

1 validation error for DataResult
data
  Input should be a valid list [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type
```
2024-03-08 12:04:14 +01:00
Ahmed Awan d57341efb8 change unfavorite tool api route:{object_id} to {object_id:path}
Tools with `/` in their id couldn't be unfavorited because the URI wouldn't be encoded
2024-03-07 20:09:50 -06:00
Dannon Baker 26b18c2cc1 Fix workflow creator validation -- name can actually be empty if you specify givenName/family_name, etc. 2024-03-07 18:42:52 -05:00
John Davis 53c2bc7c73 Merge pull request #17632 from mvdbeek/simplify_change_state_queries
[24.0] More efficient change_state queries, maybe fix deadlock
2024-03-07 16:30:28 -05:00
mvdbeek b8df73d582 Only set dataset.job if not set 2024-03-07 21:09:27 +01:00
mvdbeek 3aa957ad31 Capture job in Job.add_output_dataset 2024-03-07 16:52:53 +01:00
mvdbeek 5a3941e4f4 More efficient change_state queries, maybe fix deadlock
Here's the deadlock:

```
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.DeadlockDetected: deadlock detected
DETAIL:  Process 317 waits for ShareLock on transaction 1057; blocked by process 318.
Process 318 waits for ShareLock on transaction 1056; blocked by process 317.
HINT:  See server log for query details.
CONTEXT:  while updating tuple (0,7) in relation "dataset"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/jobs/runners/__init__.py", line 203, in put
    queue_job = job_wrapper.enqueue()
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/jobs/__init__.py", line 1589, in enqueue
    self.change_state(model.Job.states.QUEUED, flush=False, job=job)
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/jobs/__init__.py", line 1547, in change_state
    job.update_output_states(self.app.application_stack.supports_skip_locked())
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/model/__init__.py", line 2053, in update_output_states
    sa_session.execute(statement, params)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1717, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
    self._handle_dbapi_exception(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
    util.raise_(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (psycopg2.errors.DeadlockDetected) deadlock detected
DETAIL:  Process 317 waits for ShareLock on transaction 1057; blocked by process 318.
Process 318 waits for ShareLock on transaction 1056; blocked by process 317.
HINT:  See server log for query details.
CONTEXT:  while updating tuple (0,7) in relation "dataset"

[SQL:
            UPDATE dataset
            SET
                state = %(state)s,
                update_time = %(update_time)s
            WHERE id IN (
                SELECT hda.dataset_id FROM history_dataset_association hda
                INNER JOIN job_to_output_dataset jtod
                ON jtod.dataset_id = hda.id AND jtod.job_id = %(job_id)s
            );
        ]
[parameters: {'state': 'queued', 'update_time': datetime.datetime(2024, 3, 7, 12, 29, 10, 229364), 'job_id': 3}]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

```

The likely culprit for the deadlock  is that __EXTRACT_DATASET__ deals
with the same dataset as the tool that created the collection
__EXTRACT_DATASET__ is running on, they might both be attempting to
update the output state.

My thinking is that by filtering on the job_id we're not going to change
state for the `__EXTRACT_DATASET__` change_state method.
2024-03-07 15:49:10 +01:00
Nicola SoranzoandMarius van den Beek 1e95836f54 Split `raw_to_galaxy()` trans requirement to app and history
Marginal improvement, but might be nice not to be bound to
`trans.history`.

Co-authored-by: Marius van den Beek <m.vandenbeek@gmail.com>
2024-03-07 13:17:17 +00:00
Nicola Soranzo 833ad0631b Fix `do_eval()` function 2024-03-07 13:10:43 +00:00
Nicola Soranzo 1406a6111f Type annotation improvements 2024-03-07 12:58:20 +00:00
mvdbeek 67e9d5fbba Make latest_workflow_uuid optional 2024-03-07 12:42:22 +01:00
Marius van den Beek bc0d075d55 Merge pull request #17601 from nsoranzo/type_annots
Type annotation improvements
2024-03-06 16:05:44 +01:00
mvdbeek 1d5fb96af6 Merge branch 'release_24.0' into dev 2024-03-06 14:59:18 +01:00
mvdbeek 8b44fde05f Merge branch 'release_23.2' into release_24.0 2024-03-06 14:58:57 +01:00
Marius van den Beek 6728e482bf Merge pull request #17598 from mvdbeek/fix_pending_rollback_error
[23.2] Anticipate PendingRollbackError in ``check_database_connection``
2024-03-06 14:58:32 +01:00
mvdbeek c346bc02a3 Merge branch 'release_24.0' into dev 2024-03-06 14:39:42 +01:00
mvdbeek d1e654c1f7 Merge branch 'release_23.2' into release_24.0 2024-03-06 14:34:13 +01:00
Nicola Soranzo fac8eedaf4 Add `DatasetCollectionElementWrapper` type alias 2024-03-06 12:52:46 +00:00
Nicola SoranzoandDavid López 05b467d5da Remove unnecessary conversion to str
Co-authored-by: David López <46503462+davelopez@users.noreply.github.com>
2024-03-06 12:52:45 +00:00
Nicola Soranzo 0e1eb86d50 Remove unnecessary methods 2024-03-06 12:52:43 +00:00
Nicola Soranzo 159cb46c45 Add/fix type annotations 2024-03-06 12:52:42 +00:00
Dannon 88b5e657b2 Merge pull request #17607 from nsoranzo/unpin_social-auth-core
Unpin social-auth-core dependency
2024-03-06 05:58:03 -06:00
Nicola Soranzo 75f0618141 Merge branch 'release_24.0' into dev 2024-03-06 10:15:01 +00:00
Nicola Soranzo 7ffc2b75ce Don't call `get_or_create_default_history()` twice for invalidated sessions 2024-03-06 02:02:22 +00:00
John Davis 149e281a4c session may be a scoped_session and may not have a transaction 2024-03-05 17:18:01 -05:00
John Davis fb89a2651b Explicitly check for transaction state 2024-03-05 16:01:19 -05:00
John Davis 5e05e00656 Merge pull request #17016 from bernt-matthias/topic/stdio-regex-extend
[24.0] Extend regex groups in stdio regex matches
2024-03-05 14:32:57 -05:00
Nicola Soranzo e4aae9407f Unpin social-auth-core dependency
Needed to drop abandoned python-jose, which in turn depends on ecdsa,
a library that is not safe against side-channel attacks, xref.:

https://github.com/tlsfuzzer/python-ecdsa/security/advisories/GHSA-wj6h-64fc-37mp
2024-03-05 18:12:33 +00:00
mvdbeek 184d880b11 Merge branch 'release_24.0' into dev 2024-03-05 17:05:06 +01:00
John DavisandM Bernt 415f419404 Update lib/galaxy/tool_util/xsd/galaxy.xsd
Co-authored-by: M Bernt <m.bernt@ufz.de>
2024-03-05 10:39:22 -05:00
mvdbeek fde1ec3543 Merge branch 'release_23.2' into release_24.0 2024-03-05 16:33:16 +01:00
Marius van den Beek eeb2d04c78 Merge pull request #16885 from bernt-matthias/topic/dynamic-multiple
Add test and doc showing how dynamic selects are used
2024-03-05 16:25:14 +01:00