Commit Graph
40342 Commits
Author SHA1 Message Date
John Davis 16e18d404e Merge pull request #19395 from mvdbeek/alternative_format_source_fix
Alternative `format_source` fix
2025-01-23 10:54:03 -05:00
Nicola Soranzo a79f518f49 Proper subclassing of `ModelManager` generic class 2025-01-22 23:18:53 +00:00
Nicola Soranzo 345d7a588b Add type annotations 2025-01-22 23:18:53 +00:00
Nicola Soranzo 8797f1e4ef Make `InstallationTarget` a runtime-checkable protocol
Also:
- Reuse its `installed_repository_manager` attribute instead of
  instantiating a `InstalledRepositoryManager` in several places.
2025-01-22 23:14:48 +00:00
Nicola Soranzo 0f3a870be5 Fix typos 2025-01-22 23:14:48 +00:00
Nicola Soranzo 4a2bdac98b Merge branch 'release_24.2' into dev 2025-01-22 09:33:23 +00:00
Ahmed Awan 3baafc2477 Merge remote-tracking branch 'upstream/release_24.1' into HEAD 2025-01-21 10:24:32 -06:00
David López 28e5f7d84b Merge pull request #19154 from kysrpex/file_sources_assign_paths
Let file sources choose a path for uploaded files
2025-01-20 16:11:57 +01:00
José Manuel DomínguezandDavid López 3b1516c0c5 Remove remark concerning ExportObjectResultMetadata model validation
`ExportObjectResultMetadata.validate_uri()` includes commented out code as a remark for the reader that short term exports need not to have a URI as part of their result metadata. Remove this remark.

Co-authored-by: David López <46503462+davelopez@users.noreply.github.com>
2025-01-20 15:14:15 +01:00
Nicola Soranzo 54df792117 Use CompressedFile.open_tar() to open tar files 2025-01-18 15:03:02 +00:00
Nicola Soranzo aa49793ecf Make CompressedFile a context manager
to ensure that the archive is closed.
2025-01-18 14:40:30 +00:00
Nicola Soranzo ccebdcb1f2 Set safe default extraction filter for tar archives
[PEP 706](https://peps.python.org/pep-0706/), first implemented in Python
3.11.4, mitigates some of the security issues of `TarFile.extract()` and
`TarFile.extractall()` by allowing to specify a `filter` keyword-only
parameter.
Set a safe default (`data_filter`) for the filter if available,
reverting to Python 3.11 behavior ('fully_trusted') otherwise, see
https://docs.python.org/3/library/tarfile.html#supporting-older-python-versions

Also:
- Remove unused `tar` parameter from `upload_tar()`
2025-01-18 14:40:29 +00:00
galaxybot b0ce7ccfa9 Update Python dependencies
by running `make update-dependencies`.
2025-01-18 03:06:32 +00:00
davelopez eef942a240 Add number coercion to string in StrictModel configuration
This will workaround an issue with jinja templates rendering a field composed only by numbers to be considered a number when the field is of type string, causing the config model validation to fail. Trying to cast the value to string using the jinja template itself did not work.
2025-01-17 11:22:27 +01:00
Martin Cech 2411fb8887 Merge pull request #19402 from jdavcs/dev_user_email_api_help
Display email activation help only if user activation is enabled
2025-01-16 11:10:27 +01:00
José Manuel Domínguez 7a9a52af67 Add new field uri to ExportObjectResultMetadata model
Write the actual URIs where files are saved to by file sources to a new `uri` field of the `ExportObjectResultMetadata` model. Restore behavior before commit 53012bf, namely setting the history export request metadata before attempting the export.

---

Before applying the set of changes from 53012bf, the method `ModelStoreManager.set_history_export_request_metadata()` instantiates a `ExportObjectMetadata` Pydantic model and dumps it to the database in the form of JSON as the field `StoreExportAssociation.export_metadata`. After the export is complete, the method `set_history_export_result_metadata()` takes the same instance of `ExportObjectMetadata`, instantiates a `ExportObjectResultMetadata` Pydantic model, sets it as the `result_data` of the `ExportObjectMetadata` instance, and then saves the `ExportObjectMetadata` Pydantic model in the form of JSON to the database again.

After applying the set of changes, the call to `ModelStoreManager.set_history_export_request_metadata()` is delayed until the file has already been saved to the file source, as the actual URI that the file source assigns to the file is otherwise unknown.

The URI assigned by the file source overwrites the original target URI in the request. This involves a slight deviation from the previous behavior: if for example, power gets cut at the right time, `StoreExportAssociation.export_metadata` may not exist despite the history having been already saved to the file source, because database writes happen within the `finally:` block.

Moreover, overwriting the original target URI from the request is formally wrong, because the actual URI assigned by the file source should be part of the export result metadata, as it becomes known when the export completes.

This commit addresses these issues by adding a new field `uri` to the `ExportObjectResultMetadata` model, where the actual URI the file has been saved to by the file source is written. Backwards compatibility is ensured via `HistoriesService._get_export_record_data()`, which retrieves the new field when available and otherwise uses `ExportObjectRequestMetadata.payload.target_uri` (given that `ExportObjectRequestMetadata.payload` is of type `WriteStoreToPayload`).
2025-01-14 17:02:01 +01:00
John Davis 9fc0f05935 Merge pull request #19366 from galaxybot/dev_auto_update_dependencies
Update Python dependencies
2025-01-13 11:25:46 -05:00
Nicola Soranzo 39bb35bebc Merge branch 'release_24.2' into dev 2025-01-13 16:10:31 +00:00
Marius van den Beek 2d629d0f44 Merge pull request #19208 from bernt-matthias/OutputsFilterExpression-fixes
[24.2]  Outputs filter linter fixes
2025-01-13 18:09:06 +02:00
Nicola Soranzo bb438e1e8d Merge branch 'release_24.1' into release_24.2 2025-01-13 16:02:22 +00:00
John Davis 93b684e913 Display api help based on config 2025-01-13 10:13:52 -05:00
Nicola Soranzo e61121acab Use id entity attribute when setting exampleOfWork property
Fix the following error in 3 unit tests when using rocrate 0.13.0 :

```
______________________ test_export_invocation_to_ro_crate ______________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-5/test_export_invocation_to_ro_c0')

    def test_export_invocation_to_ro_crate(tmp_path):
        app = _mock_app()
        workflow_invocation = _setup_invocation(app)
        crate_directory = tmp_path / "crate"
        with store.ROCrateModelExportStore(crate_directory, app=app) as export_store:
            export_store.export_workflow_invocation(workflow_invocation)
>       validate_invocation_crate_directory(crate_directory)

tests/data/model/test_model_store.py:627:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/data/model/test_model_store.py:564: in validate_invocation_crate_directory
    validate_create_action(crate)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

ro_crate = <rocrate.rocrate.ROCrate object at 0x7fb4673c2520>

    def validate_create_action(ro_crate: ROCrate):
        workflow = ro_crate.mainEntity
        actions = [_ for _ in ro_crate.contextual_entities if "CreateAction" in _.type]
        assert len(actions) == 1
        wf_action = actions[0]
        assert wf_action["instrument"]
        assert wf_action["instrument"] is workflow
        wf_objects = wf_action["object"]
        wf_results = wf_action["result"]
        assert len(wf_objects) == 1
        assert len(wf_results) == 1
        for entity in wf_results:
            if entity.id.endswith(".txt"):
                assert "File" in entity.type
                wf_output_file = entity
                assert wf_output_file["encodingFormat"] == "text/plain"
>               assert wf_output_file["exampleOfWork"] is workflow["output"][0]
E               AssertionError: assert '#d2ed04ef-36f8-49ae-86ce-47cb03a856c0' is <d2ed04ef-36f8-49ae-86ce-47cb03a856c0 FormalParameter>

tests/data/model/test_model_store.py:540: AssertionError
```

Also:
- Remove unused `_add_step_tool_pv` method.
2025-01-13 13:04:45 +00:00
galaxybot 8dc0cf55cb Update Python dependencies
by running `make update-dependencies`.
2025-01-13 11:58:32 +00:00
mvdbeek 7566674baa Fix type annotation resulting from annotating HDCA.collection 2025-01-10 23:37:10 +02:00
mvdbeek a0919d1117 Evaulate format_source (again) just before job submission
At this point the inputs are ready, so expession.json has been replaced
with the true extension.
2025-01-10 19:19:56 +02:00
mvdbeek 20dc7b7eae Simplify determine_output_format 2025-01-10 18:55:08 +02:00
mvdbeek f65b754dd0 Add regression test for https://github.com/galaxyproject/galaxy/issues/19245 2025-01-10 18:55:08 +02:00
Nicola Soranzo dad7c26a83 Use id entity attribute when setting exampleOfWork property
Fix the following error in 3 unit tests when using rocrate 0.13.0 :

```
______________________ test_export_invocation_to_ro_crate ______________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-5/test_export_invocation_to_ro_c0')

    def test_export_invocation_to_ro_crate(tmp_path):
        app = _mock_app()
        workflow_invocation = _setup_invocation(app)
        crate_directory = tmp_path / "crate"
        with store.ROCrateModelExportStore(crate_directory, app=app) as export_store:
            export_store.export_workflow_invocation(workflow_invocation)
>       validate_invocation_crate_directory(crate_directory)

tests/data/model/test_model_store.py:627:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/data/model/test_model_store.py:564: in validate_invocation_crate_directory
    validate_create_action(crate)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

ro_crate = <rocrate.rocrate.ROCrate object at 0x7fb4673c2520>

    def validate_create_action(ro_crate: ROCrate):
        workflow = ro_crate.mainEntity
        actions = [_ for _ in ro_crate.contextual_entities if "CreateAction" in _.type]
        assert len(actions) == 1
        wf_action = actions[0]
        assert wf_action["instrument"]
        assert wf_action["instrument"] is workflow
        wf_objects = wf_action["object"]
        wf_results = wf_action["result"]
        assert len(wf_objects) == 1
        assert len(wf_results) == 1
        for entity in wf_results:
            if entity.id.endswith(".txt"):
                assert "File" in entity.type
                wf_output_file = entity
                assert wf_output_file["encodingFormat"] == "text/plain"
>               assert wf_output_file["exampleOfWork"] is workflow["output"][0]
E               AssertionError: assert '#d2ed04ef-36f8-49ae-86ce-47cb03a856c0' is <d2ed04ef-36f8-49ae-86ce-47cb03a856c0 FormalParameter>

tests/data/model/test_model_store.py:540: AssertionError
```

Also:
- Remove unused `_add_step_tool_pv` method.
2025-01-10 15:13:14 +00:00
Nicola Soranzo 9953e07e46 Merge pull request #19388 from jdavcs/dev_sa20_cleanup
SQLAlchemy 2.0 follow-up
2025-01-10 12:20:23 +00:00
Björn Grüning 9b43bf58dc Merge pull request #19301 from mvdbeek/implicit_dataset_as_input
[24.1] Record implicitly converted dataset as input dataset
2025-01-10 12:55:03 +01:00
Dannon e453ca1da5 Merge pull request #19389 from dannon/chatgxy-fixes
[24.2] Fix to only show ChatGXY when available.
2025-01-09 15:08:18 -05:00
John Davis 0acf625f90 Remove commented out block, edit comment 2025-01-09 11:54:20 -05:00
Dannon Baker 2ed796a227 Add 'llm_api_configured' key to config serializer 2025-01-08 23:21:00 -05:00
Dannon Baker 97de7f3bfe Refactor chat prompts loading to check for OpenAI API key configuration 2025-01-08 23:21:00 -05:00
John DavisandNicola Soranzo 2ba17ffecc Fix spelling
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2025-01-08 18:28:13 -05:00
John Davis 5f4090ba8e Try to disable transaction helper
If this does not break transactional state, this helper should be
removed completely.
2025-01-08 16:16:13 -05:00
John Chilton c717b3ed02 Fix for empty string in regex validator message.
xref https://github.com/galaxyproject/galaxy/issues/19386
2025-01-08 13:46:48 -05:00
mvdbeek 05ede4ab0e Fix planemo timeout handling
Planemo calls `verify_tool` with a maxseconds value,
and then sets `tool_test_dict.setdefault("maxseconds", maxseconds)`,
which fails, since we are serializing and already setting the default
maxseconds while parsing the test dict.

Fixes the IUC tool test timeouts not working when testing against 24.2.
Broken in
https://github.com/galaxyproject/galaxy/commit/9695ccc3c45a14b36beccfbaac69036a5ac65c21#diff-06835be1d1943ebce8373e2cd1f8e86c7b7813b720398850c978b734dd29e2daR1390
(maxseconds was prviously not serialized at all in
`ToolTestDescription.to_dict`)
2025-01-08 13:16:50 +02:00
John Davis 9e38cae868 Remove cascade_backrefs=False
No longer needed after move to SQLAlchemy 2.0
https://docs.sqlalchemy.org/en/20/changelog/migration_14.html#cascade-backrefs-behavior-deprecated-for-removal-in-2-0
2025-01-07 19:12:55 -05:00
Nicola Soranzo cd999d2a86 Merge branch 'release_24.2' into dev 2025-01-07 22:27:15 +00:00
Nicola Soranzo fe1bf1e3a6 Merge branch 'release_24.1' into release_24.2 2025-01-07 22:25:33 +00:00
Nicola Soranzo 058d2377f2 Merge branch 'release_24.0' into release_24.1 2025-01-07 22:23:58 +00:00
Nicola Soranzo f3e4a16935 Remove unnecessary quoting in conda package specification
Fix the following error in:
- test/unit/tool_util/test_conda_resolution.py::test_install_conda_build
- test/integration/test_resolvers.py::TestCondaResolutionIntegration::test_dependency_install
- test/integration/test_resolvers.py::TestCondaResolutionIntegration::test_uninstall_through_tools_api

```
InvalidMatchSpec: Invalid spec ''pyopenssl>=22.1.0'': Invalid version '22.1.0'': invalid character(s)
```
2025-01-07 18:58:36 +00:00
John Chilton 356ed821a4 Merge pull request #19374 from mvdbeek/improve_conditional_specificity
Make conditional discriminators literals instead of generic string/bool
2025-01-07 11:42:35 -05:00
John Chilton f8ae3ce6ec Merge pull request #19332 from mvdbeek/fix_null_replacement
[24.2] Fix workflows with optional non-default parameter input
2025-01-07 10:08:58 -05:00
mvdbeek 384dfc8b4e Make conditional discriminators literals instead of generic string/bool
That's a much better consumer experience. A model generated for
gx_conditional.xml would look like
```typescript
export type ConditionalType =
  | WhenTestParameterA
  | WhenTestParameterB
  | WhenTestParameterC
export type TestParameter = "a"
export type IntegerParameter = number
export type TestParameter1 = "b"
export type BooleanParameter = boolean
export type TestParameter2 = "c"
export type ColorParameter = string

export interface MySchema {
  conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
  test_parameter: TestParameter
  integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
  test_parameter: TestParameter1
  boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
  test_parameter: TestParameter2
  color_parameter: ColorParameter
}

```
instead of
```typescript
export type ConditionalType =
  | WhenTestParameterA
  | WhenTestParameterB
  | WhenTestParameterC
export type TestParameter = string | boolean
export type IntegerParameter = number
export type TestParameter1 = string | boolean
export type BooleanParameter = boolean
export type TestParameter2 = string | boolean
export type ColorParameter = string

export interface MySchema {
  conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
  test_parameter: TestParameter
  integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
  test_parameter: TestParameter1
  boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
  test_parameter: TestParameter2
  color_parameter: ColorParameter
}

```
With the new model I can write an input object without looking at the
tool source, with the previous one I don't know what string I would need
to supply.
2025-01-03 16:17:49 +02:00
Nicola Soranzo 25d7ab42b4 Merge branch 'release_24.2' into dev 2025-01-03 13:09:06 +00:00
Nicola Soranzo 1d44a5525f Merge branch 'release_24.1' into release_24.2 2025-01-03 13:07:37 +00:00
Nicola Soranzo 94bff7786c Type annotation fixes for mypy 1.14.0 2024-12-30 15:23:21 +00:00
dependabot[bot] 1e9cc46918 Bump jinja2 from 3.1.4 to 3.1.5 in /lib/galaxy/dependencies
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.4...3.1.5)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-25 08:49:32 +00:00