Commit Graph
336 Commits
Author SHA1 Message Date
mvdbeek 8a3d8058f6 Remove more __root__ and construct calls 2024-01-08 11:33:30 +01:00
mvdbeek 7f529e63c7 Merge branch 'release_23.2' into dev 2024-01-04 16:07:26 +01:00
mvdbeek ccdd733121 Commit and legacy backpopulate pattern from unit test 2023-12-25 10:59:05 +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 Davis 377f783e20 Commit instead of flushing in unit test
Rationale:
We use an in-memory sqlite database for quota tests. With SA 2.0 (or
with the `future` flag enabled on the engine), the following conflict
happens: (this is a simplified model)

foo = Foo()
session.add(foo)
session.flush()

engine = session.get_bind()
with engine.connect() as conn:
    conn.execute(some-sql)

foo.bar = "new value"
session.commit() # BOOM!!!!  sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'galaxy_user' expected to update 1 row(s); 0 were matched.

Reason for BOOM:
With an in-memory database, the underlying dbapi_connection object is
the same for the session and the engine.connect(). Here's what happens:

line 10: foo is flushed to the db tmp buffer
line 14: conn is closed on exit from context manager, which issues a
rollback, which rolls back whatever is in the tmp buffer - so foo is
never inserted.
line 16: foo is updated
line 17: error happens: the session thinks it's updating foo's record in
the db, but that record does not exist therefore, "0 rows matched".

Solution: commit instead of flushing - then foo is inserted.
2023-12-12 14:38:46 -05:00
John Davis 475f7227c4 Add future=True flag to SA engine 2023-12-12 09:54:08 -05:00
John Davis 95fa80105a Fix "statement is being autocommitted" SA2.0 warning 2023-12-11 16:09:44 -05:00
John Davis fc0a266bdb Merge pull request #16932 from jdavcs/dev_sa20_fix21
SQLAlchemy 2.0 upgrades (part 5)
2023-11-29 09:55:24 -05:00
John Davis eeeaf7b4cc Use distinct only for dataset states/extensions summary 2023-11-28 15:19:31 -05:00
John Davis f45e6d1e46 Add unit test; adjust tests to account for order-by columns 2023-11-27 18:39:04 -05:00
John Davis c0f6b1d2c8 Refactor, upgrade get_nested_collection_attributes
1. Upgrade Query to Select
2. Factor out query-building logic. The previous version returned tuples
   of items OR models (ORM objects), depending on the calling code
   (several similar data access methods were combined into this one
   generic method in PR #12056). The Query object would "magically"
   convert tuples of ORM objects to ORM objects. The new unified Select
   object does not do that. As as result, with Select, this method would
   return tuples of items or tuples of models (not models):

   result1 = session.execute(statement2)
   result1 == [("element_identifier_0", "element_identifier_1", "extension", "state"), ...]

   result2 = session.execute(statement2)
   result2 == [(dataset1,), (dataset2,) ...]

   Factoring out the query-building logic and having the caller execute
   it depending on the expected data structure solves this.
2023-11-27 18:30:16 -05:00
Michael R. Crusoe 14fb5acc69 importlib_resources is only needed in Python 3.8
Add type hints + fixes
2023-11-27 00:01:54 +00:00
Michael R. Crusoe df807e6d17 Use the walrus := operator!
Fixed by running:

```
ack --type=python -f | grep -v '^lib/galaxy/schema/bco/\|^lib/galaxy/schema/drs/\|^tools/\|^.venv/\|^.tox/' | grep -v '^lib/galaxy/files/sources/\|^lib/galaxy/job_metrics/\|^lib/galaxy/objectstore/\|^lib/galaxy/tool_util/\|^lib/galaxy/util/' | xargs auto-walrus
make format
```

Note that the directories for the packages listed in
`packages/packages_for_pulsar_by_dep_dag.txt`
were explictly excluded.
2023-11-26 18:34:10 +00:00
Yakubov, Sergey b342f4ccb6 rename _sync_cache -> sync_cache 2023-11-17 12:08:28 -05:00
Yakubov, Sergey 898c5c942d optimize object store pull
added sync_cache parameter to the get_filename function that allows
skip pulling to cache when not needed
2023-11-14 11:57:40 -05:00
Yakubov, Sergey c30a4c06c2 Replace file_name property with get_file_name function 2023-11-08 17:17:14 -05:00
John Chilton 59cff45fb1 Decompose tool shed + schema package.
This commit creates two new packages - below a description of these packages and why they are being created.

galaxy-schema: This package contains the pydantic models that power the API. The purpose of packaging them is to ensure they can be reused by clients with minimal external dependencies. Reusing the schema in client code would very quickly provide rapid documentation and validation and static checking for Python clients using the Galaxy API.

galaxy-tool-shed: This package contains the tool shed server code. This has been a long term project to allow the tool shed to be spun out but maintain real galaxy dependencies and maintain testing. More discussions around this project can be found as part of https://github.com/galaxyproject/galaxy/pull/8830.
2023-09-26 13:46:55 -04:00
mvdbeek effd5e8ade Merge branch 'release_23.1' into dev 2023-08-24 17:03:44 +02:00
mvdbeek 3af41be3eb Merge branch 'release_23.0' into release_23.1 2023-08-24 17:03:02 +02:00
mvdbeek cf2d28e08e Fix unit tests 2023-08-24 10:44:40 +02:00
mvdbeek c62da4aa33 Merge branch 'release_23.1' into dev 2023-08-09 16:06:08 +02:00
mvdbeek 7329575bf4 Unit test fixes 2023-07-31 14:03:32 +02:00
John Davis e54a2ec897 Fix SA2.0 syntax (query->select) in unit tests
Includes multiple upgrades to syntax.
Ref: https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#migration-orm-usage
2023-07-21 13:04:22 -04:00
John Davis 4fa4c81d56 Fix session.flush test to account for autocommit=false 2023-06-12 13:46:02 -04:00
John Davis e1e0e6358d Make unit test work for both autocommit settings
Improve change made in 70285d0 (Fix transaction error in unit test)
See that commit for more context.
2023-06-10 18:54:30 -04:00
John Davis 70285d0ee0 Fix transaction error in unit test
In galaxy, HistoryAudit.prune() executes in the context of a separate thread, where it
starts and commits a new transaction, closing a scoped session on exit. Thus, here we
should end the current transaction (via rollback) and add the History objects to a new
session, as the previous one will be closed.
2023-06-09 13:05:26 -04:00
John Davis 4f2ebe4846 Wrap session.flush in test.unit.data.model 2023-06-09 13:05:26 -04:00
John Davis e711a18f5b Wrap session.flush in test.unit.data.test_dataset_materialization 2023-06-09 13:05:26 -04:00
John Davis 2e695c876b Wrap session.flush in test.unit.data.test_metadata_limit 2023-06-09 13:05:26 -04:00
John Davis f9b2ab140a Wrap session.flush in test.unit.data.test_mutable_json_column 2023-06-09 13:05:26 -04:00
John Davis db8af1ca7e Wrap session.flush in test.unit.data.test_model_copy 2023-06-09 13:05:26 -04:00
mvdbeek 368dfb3119 Merge branch 'release_23.0' into dev 2023-06-06 15:55:12 +02:00
mvdbeek 7cb93b3d93 Support ro-crate >=0.8.0 and 0.7.0
I guess there's a chance downstream users may run into version conflicts
if we pin ro-cate to 0.7.0, and we also don't really want to bump stable
version dependencies.
2023-06-06 11:55:52 +02:00
Björn Grüning ec017fffa7 Merge pull request #16069 from jmchilton/chunking_tests
Dataset chunking tests (and small fixes)
2023-05-20 17:05:20 +02:00
John Davis f532069517 Rename helper functions 2023-05-15 13:44:32 -04:00
John Chilton 408e7b1174 bugfix: off-by-one in handling of ck_size parameter.
It would just give you an extra line with the correct offset so there is no way this would ever be detected as a UI bug - but I have some unit tests to verify the correctness.
2023-05-15 12:13:40 -04:00
John Davis 22218b5806 Allow for composite indexes and constraints; add tests 2023-05-15 11:23:01 -04:00
John Davis 98d884e5c5 Drop views 2023-04-13 18:53:44 -04:00
Nicola Soranzo 64af46c4ae Fix new B018 errors raised by ruff 0.0.260 2023-04-13 16:53:01 +01:00
Nicola Soranzo c655360e4e Merge branch 'release_23.0' into dev 2023-04-05 12:39:43 +01:00
Paul De GeestandDavid López 2146f7d1ff Update 2 test/unit/data/model/test_model_store.py
Co-authored-by: David López <46503462+davelopez@users.noreply.github.com>
2023-03-30 13:33:55 +02:00
Paul De GeestandDavid López 98c71d1c70 Update 1 test/unit/data/model/test_model_store.py
Co-authored-by: David López <46503462+davelopez@users.noreply.github.com>
2023-03-30 13:33:43 +02:00
pauldg 9105ba3ea5 formatting 2023-03-29 11:32:35 +02:00
pauldg e2882dc54c Changes to tests according to ro-crate
metadata changes
2023-03-29 11:32:34 +02:00
John Chilton 860b4c0fd2 Unit tests for corrupted user.disk_usage being fixed 2023-03-17 16:19:22 +01:00
John Chilton 5eb6ca6ebf Unit test to improve quota stuff. 2023-03-17 16:19:22 +01:00
mvdbeek 756d047e1c Merge branch 'release_23.0' into dev 2023-03-06 18:08:05 +01:00
John Chilton 92270afe08 Merge pull request #15654 from jmchilton/object_store_ui_followup
Follow up on object store selection PR.
2023-03-03 10:17:34 -05:00