Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task-based history export tracking #14839

Merged
merged 55 commits into from
Dec 12, 2022

Conversation

davelopez
Copy link
Contributor

@davelopez davelopez commented Oct 21, 2022

Requires #15090 (To pass the remaining integration test failure)
Fixes #14511
Related to #14771

TLDR

This PR enables the tracking of every history export (and potentially any other exportable object) in the database by adding a new table containing structured metadata about the export context.
It also creates a new HistoryExport component in the UI that is based on the asynchronous task (Celery) system instead of the regular job system for handling exports and short-term downloads (#14511).

Backend Changes

  • Adds a new store_export_association table to track any object export associated with a task. This table has an export_metadata column containing information about the export context (request and result) in a structured JSON (modeled with Pydantic objects).

  • Adds a new StoreExportTracker class to associate export metadata with any exportable object.

  • Refactors the HistoryExportView to HistoryExportManager for managing the exports associated with histories.

  • Adapts the model_stores to generate and associate the export metadata to history downloads and remote exports.

  • Refactors the Tasks API to use an abstract AsyncTaskManager and the corresponding CeleryAsyncTaskManager implementation to query tasks status.

  • Modifies the /api/histories/{id}/exports endpoint to accept a new type application/vnd.galaxy.task.export+json that will return the new task-based export associations. It will continue returning the previous "JEHAs" using the default request accept type so it's backward compatible.

  • Some other small refactorings for the schemas, removing unused code, etc.

Frontend Changes

Added several new components to display information on the last export and previous ones along with actions to download them again or re-import them from remote sources, or even choose the preferred archive format. They provide similar functionality as the previous components (that still are used when Celery is not enabled) and include a bit more related to the export tracking.

Choose Export Options

Now you can decide which export format and dataset files want to include in the archive.

image

Direct Download (Temporal)

When you use the direct download option, it will be reused (the package won't be regenerated) whenever you try to download it again until:

  • The download link expires

  • The history changes

  • The export parameter change

    image

Export to Remote File Source (Long term)

When you export your history to a remote file source a reference will be stored in the record and you can reimport it later as long as the remote file source maintains the exported package.
image

List of previous exports

You can download or reimport copies (snapshots) of previous versions of the history as long as they have not expired or the remote source maintains them.
image

TODO

  • Display options to select/change the export format
  • Add a bunch of tests
  • Make the UI reactive to history changes (requires history store (Pinia) for composition API)

How to test the changes?

(Select all options that apply)

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@github-actions github-actions bot added area/API area/database Galaxy's database or data access layer labels Oct 21, 2022
@mvdbeek mvdbeek requested review from mvdbeek and jmchilton October 25, 2022 14:23
@davelopez davelopez force-pushed the history_export_tracking branch from d9c61df to 39f3ce7 Compare October 27, 2022 12:22
@davelopez davelopez force-pushed the history_export_tracking branch from 53aee09 to 452ef8b Compare November 4, 2022 13:40
@davelopez davelopez mentioned this pull request Nov 4, 2022
9 tasks
@davelopez davelopez force-pushed the history_export_tracking branch from 452ef8b to 0c170c7 Compare November 14, 2022 16:27
@davelopez davelopez force-pushed the history_export_tracking branch from 0c170c7 to b796f09 Compare November 16, 2022 16:56
@davelopez davelopez force-pushed the history_export_tracking branch 3 times, most recently from 9186a4d to 2a63069 Compare November 23, 2022 14:13
@davelopez davelopez force-pushed the history_export_tracking branch 4 times, most recently from cb66ca7 to 1bf07b6 Compare November 30, 2022 13:44
@davelopez davelopez force-pushed the history_export_tracking branch 2 times, most recently from b5cb932 to cb19bd4 Compare December 5, 2022 16:03
@davelopez
Copy link
Contributor Author

davelopez commented Dec 5, 2022

This one should be ready for review now 😃

I will keep it in draft mode because the integration test TestHistoryImportExportFtpSeleniumIntegrationWithTasks::test_history_export_tracking will fail until #15090 is merged.

I plan to follow up too with some reactivity improvements once #15108 is ready, to refresh the state when the associated history changes but I would appreciate feedback on the UI and backend changes 🙏

@mvdbeek mvdbeek force-pushed the history_export_tracking branch from cb19bd4 to 3489de7 Compare December 6, 2022 14:44
@davelopez davelopez force-pushed the history_export_tracking branch 2 times, most recently from 8ea31bc to e35db6d Compare December 8, 2022 09:07
@davelopez davelopez added this to the 23.0 milestone Dec 8, 2022
@jmchilton
Copy link
Member

This is utterly wonderful - you're amazing!

@davelopez
Copy link
Contributor Author

Thank you so much @jmchilton, you are the amazing one! :D

@davelopez davelopez force-pushed the history_export_tracking branch 2 times, most recently from 1b510ad to 59e9a1f Compare December 9, 2022 18:31
This is more explicit and consistent, also plays nicely with the client generated code.
- Remove redundant docstring in service.
- Update client generated schema.
And use the generated OpenAPI types.
Unfortunately the response is always inferred from the default content type 'application/json' so we need to change it to 'unknown' and the cast it to the expected type manually.
This selenium test is for testing the previous history export UI that is based on jobs and not tasks.
Since Celery is enabled by default in the test instance it is more consistent to convert it into an integration selenium test to modify the config and disable Celery.
@davelopez davelopez force-pushed the history_export_tracking branch from 59e9a1f to e857985 Compare December 10, 2022 10:30
@davelopez davelopez changed the title Explore task-based history export tracking Add task-based history export tracking Dec 10, 2022
@davelopez davelopez marked this pull request as ready for review December 10, 2022 11:42
@davelopez
Copy link
Contributor Author

This is finally green! :)

Let me know if there is something I can further improve or fix.
I will follow up with some reactivity improvements once #15108 is ready.

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely amazing work, thanks so much @davelopez!

@mvdbeek mvdbeek merged commit 169705f into galaxyproject:dev Dec 12, 2022
@mvdbeek mvdbeek added kind/enhancement kind/feature highlight/power-user Included at bottom of user-facing release notes (please use either this or highlight, but not both) labels Dec 12, 2022
@galaxyproject galaxyproject deleted a comment from github-actions bot Dec 12, 2022
@davelopez davelopez deleted the history_export_tracking branch December 12, 2022 09:23
@davelopez davelopez mentioned this pull request May 22, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API area/database Galaxy's database or data access layer highlight/power-user Included at bottom of user-facing release notes (please use either this or highlight, but not both) kind/enhancement kind/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch history export (UI?) to use STS
3 participants