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
430ce29c
Commit
430ce29c
authored
Jun 04, 2020
by
Romain Therville
☕
Browse files
Merge branch 'dev' into 'master'
Merge branch Dev with master See merge request
!107
parents
384a7de2
bb27a314
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/ng6/analysis.py
View file @
430ce29c
...
...
@@ -622,7 +622,7 @@ class Analysis (Component):
file_name
=
os
.
path
.
basename
(
file
)
else
:
copyfile
(
file
,
os
.
path
.
join
(
self
.
__get_work_directory
(),
file_name
))
return
'fileadmin'
+
os
.
path
.
join
(
self
.
directory
,
file
_name
)
return
self
.
get_web_filepath
(
file_name
,
'
file
admin'
)
def
_save_files
(
self
,
files
,
gzip
=
False
):
"""
...
...
@@ -722,6 +722,8 @@ class Analysis (Component):
return
t3mysql
.
select_analysis_directory
(
str
(
self
.
id
))
def
change_space
(
self
,
space_id
):
import
os
from
ng6.project
import
Project
ng6conf
=
NG6ConfigReader
()
old_path
=
ng6conf
.
get_save_directory
()
+
self
.
directory
...
...
@@ -749,6 +751,16 @@ class Analysis (Component):
t3mysql
=
t3MySQLdb
()
t3mysql
.
update_fields
(
'tx_nG6_analyze'
,
str
(
self
.
id
),
[
'directory'
,
'retention_date'
],
[
str
(
"/"
+
new_relative_path
),
new_retention
]
)
result_files
=
t3mysql
.
get_analysis_result_files
(
str
(
self
.
id
),
'fileadmin'
)
for
result_file
in
result_files
:
filename
=
os
.
path
.
basename
(
result_file
[
'rvalue'
])
new_filepath
=
self
.
get_web_filepath
(
filename
)
t3mysql
.
update_fields
(
'tx_nG6_result'
,
str
(
result_file
[
'uid'
]),
[
'rvalue'
],
[
str
(
new_filepath
)]
)
return
[
retcode
,
str_cmd
]
def
get_web_filepath
(
self
,
file_name
,
base_filepath
=
'fileadmin'
):
return
base_filepath
+
os
.
path
.
join
(
self
.
directory
,
file_name
)
\ No newline at end of file
src/ng6/t3MySQLdb.py
View file @
430ce29c
...
...
@@ -1066,4 +1066,15 @@ class t3MySQLdb(object):
qresult
=
self
.
execute
(
sql
)
return
[
r
[
0
]
for
r
in
qresult
.
rows
]
def
get_analysis_result_files
(
self
,
analysis_id
,
base_filepath
=
'fileadmin'
):
sql
=
"SELECT uid, rvalue FROM tx_nG6_result WHERE analyze_id='"
+
str
(
analysis_id
)
+
"' AND rvalue LIKE '"
+
str
(
base_filepath
)
+
"%'"
qresult
=
self
.
execute
(
sql
)
results
=
[]
for
result
in
qresult
.
rows
:
results
.
append
({
'uid'
:
result
[
0
],
'rvalue'
:
result
[
1
],
})
return
results
\ No newline at end of file
workflows/switch_space_id/components/move_project.py
View file @
430ce29c
...
...
@@ -35,7 +35,6 @@ def migrate_project (project_id, new_space_id, output):
fh
.
write
(
log_text
)
fh
.
close
()
logging
.
getLogger
(
"move_project.py"
).
debug
(
log_text
)
print
(
"os.path.exists("
+
log_file
+
")="
+
str
(
os
.
path
.
exists
(
log_file
)))
ng6conf
=
NG6ConfigReader
()
base_path
=
ng6conf
.
get_save_directory
()
...
...
@@ -65,7 +64,7 @@ def migrate_project (project_id, new_space_id, output):
log_to_output_files
(
str_log
,
output
)
analyzes
=
project
.
get_analysis
()
for
analysis
in
analyzes
:
for
analysis
in
analyzes
:
str_log
=
"
\t
- ##ANALYSE PROJECT '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
") - "
+
analysis
.
directory
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
...
...
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