-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add History Archival feature #16003
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 History Archival feature #16003
Conversation
|
This is fantastic! looks like it addresses both of the main use cases, how exciting! |
8ae31f9 to
694da99
Compare
|
@davelopez so here's what's happening with the migrations error. There are two. The first one (the one we discussed) happens because of the Once that one is fixed, another error is raised, that one is SQLite-specific: handling foreign keys in batch operations mode requires separate statements (here's a detailed discussion). So, my suggestions are as follows:
def upgrade():
with transaction():
add_column(
table_name,
sa.Column(column_name, sa.Boolean(), default=False, server_default=sa.false()),
)
create_index(index_name, table_name, [column_name])
def downgrade():
with transaction():
drop_index(index_name, table_name)
drop_column(table_name, column_name)
fk_name = f"fk_{table_name}_{column_name}"
column = sa.Column(
column_name,
sa.Integer,
nullable=True,
default=None,
)
def upgrade():
with transaction():
add_column(table_name, column)
create_foreign_key(fk_name, table_name, ref_table_name, [column_name], ["id"])
def downgrade():
with transaction():
drop_constraint(fk_name, table_name)
drop_column(table_name, column_name)(We definitely need an automated naming convention - to ensure that the indexes and constraints automatically created from our model definitions match those created via migrations. It's on my todo list.) |
694da99 to
f3ac881
Compare
|
Thank you again for all the help @jdavcs!
I decided to keep both in the same revision file, but I'm happy to split them if this is important. The updated commit is 110361d. Update: looks like I'm still doing something wrong... https://github.com/galaxyproject/galaxy/actions/runs/4957569426/jobs/8869412400?pr=16003 |
f3ac881 to
69fc540
Compare
It's not your code - it's related to the naming convention I mentioned in my previous comment. The test starts out when the foreign key constraint had been already added by SQLAlchemy (as per the model definition). It was added with a different name - so when the test tries to run a downgrade, the constraint is not found. (if you were to start on a previous version - as you did in development - make the change and add the revision, then run upgrade - then the constraint would have the name you gave it and all would've been tip-top! However, since the test starts with a blank database (as it should), the constraint name specified in the revision script is never applied. Changing the name to match what's generated is easy for postgres ( |
3eef81a to
7852258
Compare
fb4cfdc to
b15c51a
Compare
b15c51a to
012713d
Compare
Display a different confirmation message when unarchiving a purged history to make it clear that the history contents can only be restored if a new copy is imported from the export record.
This will be confusing as the upload will be done in the current history and not necessarily this one.
If there are no writeable file sources available in the server then the export record cannot be persisted. In this situation we only allow regular archival without freeing up space.
Using the export tracking functionality to associate export records requires Celery to be enabled in the instance.
It is redundant with the Snapshot badge
The fetcher call return an ApiError that was not handled in `errorMessageAsString`
Otherwise the purge will be rejected due to immutability restrictions on archived.
- Do not use _ on fetch function names - Fix optional query parameter in unarchiveHistory
We are already allowing @ts-ignore comments inside Vue files, but the linter is stricter in plain TS files. We should remove it anyway when we update or replace the fetcher library.
Co-authored-by: Enis Afgan <afgane@gmail.com>
9c37961 to
3583e8e
Compare
|
I've fixed all the conflicts and updated de db migration script commit with the latest revision. This should be ready to go if someone has time to review it 🙇♂️ |
|
This is really great work @davelopez. It looks like it's working well, to me, so let's get it in and just iterate on it if anything pops up during testing! |
Implementation of #14771
Depends on #16075 and #16143
UI
There is a new option on the histories menu to let you "archive" a history (moving it out of your active histories)
When
Archivinga history, depending on the server configuration, we are presented with 2 options, one to Keep the storage space and another to free the storage space taken by the history.Keep storage space (option A)
This option will just mark the history as being Archived and will no longer be shown in the regular histories listing or the "History Selector".
Some characteristics of this kind of archived histories:
restoredat any moment, effectively moving it back to your active histories.Free storage space (option B)
This option will allow the user to package & export the history to a permanent remote source as a backup snapshot and then purge the history and its contents to free up storage space.
After generating the export record the user should acknowledge that the original history will be permanently deleted and then proceed to archive it.
Some characteristics of this kind of archived histories:
Archived Histories
Just a simple list where you can explore your archived histories and restore or reimport them as necessary.
Backend
The backend implementation builds on top of #14839, this allows to optionally associate an export record at the time of archival so the actual contents of the history can be purged.
Only export records targeting a permanent file source are considered for archival backup.
Changes in the database
historytable now contains 2 new columns:archived: just a flag to indicate that this history is no longer part of the active histories of the user.archive_export_id: the optional ID of an export record that contains a persisted backup snapshot of the history.New API routes
GET /api/histories/archived: returns the list of archived histories of the user. Supports filtering and pagination as other similar endpoints.POST /api/histories/{history_id}/archive: marks a history as archived. Optionally it can associate an export record and purge the history.PUT /api/histories/{history_id}/archive/restore: will restore the history (unarchive, move it back to your active histories). Purged histories are not restored by default but you can still "force" the unarchival by using theforce=truequery parameter. It will be then like one of your regular purged histories.How to test the changes?
License