mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add dataset filename table. Filenames can now be assigned, setting the readonly flag on a dataset filename object
will prevent Galaxy from deleting the file when the dataset is purged. Copies of datasets (such as when sharing a
history), no longer copy file contents.
Database changes required:
CREATE TABLE dataset_filename (
id INTEGER NOT NULL,
create_time TIMESTAMP DEFAULT current_timestamp,
update_time TIMESTAMP DEFAULT current_timestamp,
filename TEXT,
extra_files_path TEXT,
readonly BOOLEAN,
PRIMARY KEY (id)
);
ALTER TABLE dataset ADD filename_id INTEGER;
This commit is contained in:
@@ -74,13 +74,14 @@ def purge( app, days ):
|
||||
""" Purges deleted datasets older than specified number of days """
|
||||
count = 0
|
||||
now = time.time()
|
||||
for row in app.model.Dataset.table.select().execute():
|
||||
for row in list(app.model.Dataset.table.select().execute()):
|
||||
data = app.model.Dataset.get(row.id)
|
||||
if data.deleted and not data.purged:
|
||||
last = time.mktime( time.strptime( data.update_time.strftime('%a %b %d %H:%M:%S %Y') ))
|
||||
diff = (now - last) /3600/24 # days
|
||||
if diff>days:
|
||||
data.purge()
|
||||
data.flush()
|
||||
count += 1
|
||||
try:
|
||||
app.model.flush()
|
||||
|
||||
Reference in New Issue
Block a user