Commit a13cee34 authored by Gerald Salin's avatar Gerald Salin
Browse files

Add default retention time for data associated wxith runs and analyses

parent 6afb85d9
......@@ -158,4 +158,13 @@ class NG6ConfigReader(object):
server_params.append(self.reader.get('global', 'server_socket_port'))
return server_params
# except :
# raise Error("Failed when parsing the config file !")
\ No newline at end of file
# raise Error("Failed when parsing the config file !")
def get_retention_time(self):
"""
return the retention time parameter
@return: retention_time
"""
try:
return self.reader.get('global', 'retention_time')
except :
raise Error("Could not retrieve retention_time !")
\ No newline at end of file
......@@ -300,13 +300,13 @@ class t3MySQLdb(object):
"""
cruser_id = self.get_user_id(cruser_login)
crdate = str(time.mktime(datetime.date.today().timetuple())).split(".")[0]
retention_date = time.mktime((datetime.date.today() + datetime.timedelta(days=365*int(self.cfg_reader.get_retention_time()))).timetuple())
sql = "INSERT INTO tx_nG6_run (pid, tstamp, crdate, cruser_id, name, date, directory, species, data_nature,\
type, nb_sequences, full_seq_size, description, hidden, sequencer) VALUES ('%s', '%s', '%s', %s, '%s', '%s','%s',\
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, self.esc_q(name),
type, nb_sequences, full_seq_size, description, hidden, sequencer, retention_date, data_state) VALUES ('%s', '%s', '%s', %s, '%s', '%s','%s',\
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, self.esc_q(name),
time.mktime(date.timetuple()), directory, self.esc_q(species),
self.esc_q(data_nature), self.esc_q(type), nb_sequences,
full_seq_size, self.esc_q(description), hidden, self.esc_q(sequencer))
full_seq_size, self.esc_q(description), hidden, self.esc_q(sequencer),retention_date, "stored")
qresult = self.execute(sql, commit = True)
run_id = qresult.lastrowid
......@@ -677,18 +677,19 @@ class t3MySQLdb(object):
"""
cruser_id = self.get_user_id(cruser_login)
crdate = str(time.mktime(datetime.date.today().timetuple())).split(".")[0]
retention_date = time.mktime((datetime.date.today() + datetime.timedelta(days=365*int(self.cfg_reader.get_retention_time()))).timetuple())
if is_editable : analysis_is_editable = 1
else : analysis_is_editable = 0
sql = "INSERT INTO tx_nG6_analyze (pid, tstamp, crdate, cruser_id, class, name, \
description, date, directory, software, version, \
hidden, params, is_editable, parent_uid) \
hidden, params, is_editable, parent_uid, retention_date, data_state) \
VALUES ('%s', '%s', '%s', %s, '%s','%s', '%s', \
'%s', '%s', '%s', '%s', '%s', '%s' ,'%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, aclass,
'%s', '%s', '%s', '%s', '%s', '%s' ,'%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, aclass,
self.esc_q(name), self.esc_q(description), crdate,
directory, self.esc_q(software), self.esc_q(version),
hidden, self.esc_q(params), analysis_is_editable, parent_uid )
hidden, self.esc_q(params), analysis_is_editable, parent_uid, retention_date, "stored" )
qresult = self.execute(sql, commit= True)
analysis_id = qresult.lastrowid
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment