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:
Daniel Blankenberg
2007-09-24 19:42:09 +00:00
parent 57750f52cc
commit ed964dd043
5 changed files with 114 additions and 60 deletions
+2 -1
View File
@@ -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()