Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
5ca5e424
Commit
5ca5e424
authored
Feb 11, 2019
by
Gerald Salin
Browse files
#89
: rundate and analysis date are set one day before the real date
parent
a4bbb772
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ng6/t3MySQLdb.py
View file @
5ca5e424
...
...
@@ -22,7 +22,7 @@ __version__ = '1.0'
__email__
=
'support.bioinfo.genotoul@inra.fr'
__status__
=
'beta'
import
datetime
,
time
,
logging
import
datetime
,
time
,
calendar
,
logging
import
pymysql
import
pymysql.cursors
import
collections
...
...
@@ -183,7 +183,7 @@ class t3MySQLdb(object):
if
self
.
project_exists
(
name
)
:
raise
ValueError
(
"Impossible to create project %s, this name is already used!"
%
name
)
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
if
cruser_login
:
# If the administrator login is specified
admin_id
=
self
.
get_user_id
(
cruser_login
)
...
...
@@ -298,13 +298,14 @@ class t3MySQLdb(object):
@param cruser_login : the create user login
@param hidden : is the analysis hidden
"""
logging
.
getLogger
(
"t3MySQLdb.add_run"
).
debug
(
"Inserting run with date of run ="
+
str
(
date
))
cruser_id
=
self
.
get_user_id
(
cruser_login
)
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
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, retention_date, data_state, purged_date, purged_size, mail_sent_date) VALUES ('%s', '%s', '%s', %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
.
mk
time
(
date
.
timetuple
()),
directory
,
self
.
esc_q
(
species
),
calendar
.
time
gm
(
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
),
retention_date
,
"stored"
,
"0"
,
"0"
,
"0"
)
qresult
=
self
.
execute
(
sql
,
commit
=
True
)
...
...
@@ -324,7 +325,7 @@ class t3MySQLdb(object):
@param project_id : the project_id the run belong to
@param run_id : the run to add
"""
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
sql
=
"INSERT INTO tx_nG6_project_run (pid, tstamp, crdate, project_id, run_id)
\
VALUES('%s', '%s', '%s', '%s','%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
project_id
,
run_id
)
self
.
execute
(
sql
,
commit
=
True
)
...
...
@@ -581,7 +582,7 @@ class t3MySQLdb(object):
@param name : the sample name
@return sample id
"""
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
column_names
=
[
'pid'
,
'tstamp'
,
'run_id'
,
'sample_id'
,
'reads1'
]
column_vals
=
[
"'%s'"
%
self
.
cfg_reader
.
get_pid
(),
"'%s'"
%
crdate
,
...
...
@@ -676,7 +677,7 @@ class t3MySQLdb(object):
@param is_editable : True if analysis has been added by an user
"""
cruser_id
=
self
.
get_user_id
(
cruser_login
)
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
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
...
...
@@ -707,7 +708,7 @@ class t3MySQLdb(object):
@param project_id : the project_id the analysis has been done on
@param analysis_id : the analysis id
"""
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
sql
=
"INSERT INTO tx_nG6_project_analyze (pid, tstamp, crdate, project_id,
\
analyze_id) VALUES('%s','%s','%s','%s','%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
project_id
,
analysis_id
)
self
.
execute
(
sql
,
commit
=
True
)
...
...
@@ -718,7 +719,7 @@ class t3MySQLdb(object):
@param run_id : the run_id the analysis has been done on
@param analysis_id : the analysis id
"""
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
sql
=
"INSERT INTO tx_nG6_run_analyze (pid, tstamp, crdate, run_id, analyze_id)
\
VALUES('%s', '%s', '%s', '%s', '%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
run_id
,
analysis_id
)
self
.
execute
(
sql
,
commit
=
True
)
...
...
@@ -732,7 +733,7 @@ class t3MySQLdb(object):
@param value : the result value
@param group : the group value
"""
crdate
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
crdate
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
sql
=
"INSERT INTO tx_nG6_result (pid, tstamp, crdate, analyze_id, file, rkey, rvalue, rgroup)
\
VALUES('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
analysis_id
,
file
,
key
,
value
,
group
)
...
...
@@ -993,7 +994,7 @@ class t3MySQLdb(object):
return
(
qresult
)
def
set_purge_demand_deleted
(
self
,
demand_ids
):
date
=
str
(
time
.
mk
time
(
datetime
.
date
.
today
().
timetuple
()
)).
split
(
"."
)[
0
]
date
=
str
(
time
.
time
()).
split
(
"."
)[
0
]
parts
=
[
'SELECT'
,
'tx_nG6_purge_demand.uid AS demand_id,'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment