Commit Graph
7910 Commits
Author SHA1 Message Date
Lucille Delisle 5ba85f3f9f add the tool to the sample_tool_conf.xml 2024-01-25 16:21:22 +01:00
Nicola Soranzo 0e7b0eb83b Extend .venv paths to ignore
Useful when creating virtual environments for several Python versions
(e.g. `.venv38`, `.venv312`), which otherwise are linted by tools like
black, isort and flake8.
2024-01-22 20:33:47 +00:00
Nicola Soranzo 12ad482d66 Fix B038 errors reported by flake8-bugbear 24.1.17 2024-01-22 20:33:47 +00:00
Nicola Soranzo a11f77d4be Merge pull request #17335 from davelopez/fix_quotas_id_encoding
Fix quotas ID encoding
2024-01-22 18:34:38 +00:00
davelopez 0618dd8478 Add test to check quota IDs are encoded correctly 2024-01-22 17:57:55 +01:00
Nicola Soranzo 9978004f34 Fix tests after Python 3.12 changes for comprehensions 2024-01-21 20:46:09 +00:00
mvdbeek e02a765b7b Merge branch 'release_23.2' into dev 2024-01-18 12:23:00 +01:00
mvdbeek ef26fc4685 Use MockApp instead of celery_injected_app_container
Sorry, I guess the idea was to not have to build a full MockApp ?
Realisitically all tasks access the database at this point.
I suppose we could make the decorators more specific if necessary ?
2024-01-17 12:45:20 +01:00
mvdbeek a88dbdd177 Discard connection after task completion
Running the test without removing the session yields:
```
celery.app.trace ERROR 2024-01-17 11:49:42,502 [pN:main,p:81158,tN:Thread-2 (start)] Task integration.test_celery_tasks.use_session[0f89df2c-4960-4aac-8e1a-ce431dae6749] raised unexpected: PendingRollbackError("Can't reconnect until invalid transaction is rolled back.")
Traceback (most recent call last):
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/lib/galaxy/celery/__init__.py", line 181, in wrapper
    rval = app.magic_partial(func)(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/lagom/wrapping.py", line 28, in _bound_func
    return inner_func(*bound_args, **bound_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/lagom/wrapping.py", line 45, in _error_handling_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/test/integration/test_celery_tasks.py", line 42, in use_session
    sa_session().query(HistoryDatasetAssociation).get(1)
  File "<string>", line 2, in get
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/util/deprecations.py", line 468, in warned
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 947, in get
    return self._get_impl(ident, loading.load_on_pk_identity)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 951, in _get_impl
    return self.session._get_impl(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2975, in _get_impl
    return db_load_fn(
           ^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
    session.execute(
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1717, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1808, in _execute_context
    conn = self._revalidate_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 650, in _revalidate_connection
    self._invalid_transaction()
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 622, in _invalid_transaction
    raise exc.PendingRollbackError(
sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid transaction is rolled back. (Background on this error at: https://sqlalche.me/e/14/8s2b)
FAILEDINFO:     127.0.0.1:59776 - "GET /api/jobs?state=running HTTP/1.1" 200 OK
```

The fix here is to set a unique scope for the session registry.
This means that the task is guranteed to get a new, unshared session,
and this session gets removed after completing the task.

The docstring of session.remove says:
```
       This will first call :meth:`.Session.close` method
        on the current :class:`.Session`, which releases any existing
        transactional/connection resources still being held; transactions
        specifically are rolled back.  The :class:`.Session` is then
        discarded.   Upon next usage within the same scope,
        the :class:`.scoped_session` will produce a new
        :class:`.Session` object.
```
which I think is what we want after every celery task (for now, at least).
It might make sense to discard the session for any long-running task
that doesn't require database access in the future.

Fix scope
2024-01-17 12:41:43 +01:00
John Chilton 0953118f9a Allow job files to consume TUS uploads 2024-01-16 10:03:02 -05:00
Nicola Soranzo 81a16d3e92 Skip unit tests that require node when it's not installed 2024-01-15 18:32:05 +00:00
mvdbeek 03f01da108 Merge branch 'release_23.2' into dev 2024-01-15 12:09:43 +01:00
mvdbeek a2cb91487a Merge branch 'release_23.1' into release_23.2 2024-01-15 12:05:09 +01:00
mvdbeek 01502917f7 Fix `to_cwl` for nested collections
Fixes
```
TypeError
Object of type DatasetCollection is not JSON serializable
```
seen when running https://github.com/galaxyproject/iwc/pull/315
2024-01-12 12:24:59 +01:00
John Chilton b3c256d0b4 Merge pull request #17266 from bernt-matthias/topic/assign_primary
Fixes for output discovery
2024-01-11 09:15:46 -05:00
Matthias Bernt 181d5d2598 add test cases showing bug 2024-01-10 14:34:14 +01:00
mvdbeek 04441e503c Fix encoded id unit test 2024-01-08 11:33:44 +01:00
mvdbeek a13932c71c Fix id field unit tests 2024-01-08 11:33:34 +01:00
mvdbeek 649895eb8d .dict() -> .model_dump() 2024-01-08 11:33:32 +01:00
mvdbeek 79f1c292b5 Drop more deprecated .dict() and .construct() calls 2024-01-08 11:33:31 +01:00
mvdbeek ac41a2bd44 More root and model fixes 2024-01-08 11:33:30 +01:00
mvdbeek 8a3d8058f6 Remove more __root__ and construct calls 2024-01-08 11:33:30 +01:00
mvdbeek ed1c30a8b9 Fix fetch_data schema unit tests 2024-01-08 11:33:29 +01:00
mvdbeek 1593570e33 Replace DecodedDatabaseIdField.encode with Security.security.encode_id 2024-01-08 11:33:25 +01:00
mvdbeek 7f529e63c7 Merge branch 'release_23.2' into dev 2024-01-04 16:07:26 +01:00
mvdbeek bc5259f5d2 Merge branch 'release_23.1' into release_23.2 2024-01-04 16:02:16 +01:00
Marius van den Beek 6dfea69740 Merge pull request #17234 from mvdbeek/single_api_instance
Reuse test instance during non-integration tests
2024-01-04 11:58:23 +01:00
Marius van den Beek d0a7562ad7 Merge pull request #17236 from mvdbeek/fix_schema_integrity
[23.1] Separate collection and non-collection data element
2024-01-02 20:41:31 +02:00
Nuwan Goonasekera fe971b2aa6 Merge pull request #16977 from nuwang/oidc_api_auth
Support for OIDC API Auth and OIDC integration tests
2024-01-02 18:53:50 +05:30
mvdbeek d65d3112ac Make framework tool tests use driver fixture 2024-01-01 15:05:19 +02:00
Marius van den Beek b1d5f77f51 Merge pull request #17235 from galaxybot/dev_auto_update_dependencies
Update Python dependencies
2024-01-01 15:05:02 +02:00
mvdbeek 68211090e6 Skip test when ftp.gnu.org not available 2024-01-01 11:21:49 +02:00
mvdbeek 242f75ceec Type fixes for starlette 0.34.0
Starlette removed some Any annotations in 0.34.0.
Issue tracked in https://github.com/abersheeran/a2wsgi/issues/44
2024-01-01 11:13:40 +02:00
mvdbeek 4027c99350 Skip test when ftp.gnu.org not available 2024-01-01 10:07:30 +02:00
mvdbeek ccdd733121 Commit and legacy backpopulate pattern from unit test 2023-12-25 10:59:05 +01:00
mvdbeek 8bab912a7f Move display application link test to integration test 2023-12-25 10:38:21 +01:00
Tillman 1b9d632a08 Remove comments 2023-12-23 15:43:07 +01:00
Tillman 9b2435ec7b Add test for report_pdf operations of InvocationAPI 2023-12-23 15:43:07 +01:00
mvdbeek 5e7401a285 Merge branch 'release_23.2' into dev 2023-12-23 15:18:08 +01:00
mvdbeek 7105af4917 Merge branch 'release_23.1' into release_23.2 2023-12-23 15:17:49 +01:00
mvdbeek 1113f4c744 Fix User.current_galaxy_session 2023-12-23 10:34:11 +01:00
John Chilton 4bb1c4b4ce Merge pull request #17205 from jdavcs/dev_cbv
Vendorize fastapi-utls.cbv
2023-12-22 10:28:32 -05:00
Marius van den Beek 9d2a1cdcef Merge pull request #17209 from bernt-matthias/converter-reload
Reload built-in converters on toolbox reload
2023-12-19 16:07:52 +01:00
Nuwan Goonasekera 56edd297aa Merge branch 'dev' into oidc_api_auth 2023-12-19 18:33:05 +05:30
mvdbeek 038d31eb34 Merge branch 'release_23.2' into dev 2023-12-19 12:01:19 +01:00
Matthias Bernt e725f421b4 Reload built-in converters on toolbox reload
fixes #16947

also adds a setter to `MockApp` in order to fix the following
which was shown during tests

```
  /home/berntm/projects/galaxy/.venv/lib/python3.10/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-7 (check)

  Traceback (most recent call last):
    File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
      self.run()
    File "/usr/lib/python3.10/threading.py", line 953, in run
      self._target(*self._args, **self._kwargs)
    File "/home/berntm/projects/galaxy/lib/galaxy/tool_util/toolbox/watcher.py", line 153, in check
      self.reload_callback()
    File "/home/berntm/projects/galaxy/lib/galaxy/app_unittest_utils/toolbox_support.py", line 44, in <lambda>
      app.watchers.tool_config_watcher.reload_callback = lambda: reload_callback(test_case)
    File "/home/berntm/projects/galaxy/lib/galaxy/app_unittest_utils/toolbox_support.py", line 193, in reload_callback
      test_case._toolbox = test_case.app.toolbox = SimplifiedToolBox(test_case)
  AttributeError: can't set attribute 'toolbox'

    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
```
2023-12-19 11:31:06 +01:00
John Davis 7d6a0eed19 Fix import in unit test 2023-12-18 15:03:10 -05:00
John Davis c6dad0bce6 Fix linting, add attribution 2023-12-18 14:51:58 -05:00
John Davis a8a2903a31 Copy fastapi-utils.cbv.py + unit tests, change import 2023-12-18 14:16:48 -05:00
Nate Coraor c650007360 Cgroupsv2 metrics instrumenter tests 2023-12-14 13:29:19 -05:00