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
Statistical-Genetics
jass
Commits
1d64718b
Commit
1d64718b
authored
May 24, 2022
by
Bryan BRANCOTTE
Browse files
dump metadata in a celery task, backend serve the content of the metadata file
parent
cb1e05e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
client/pages/projects/_id.vue
View file @
1d64718b
...
...
@@ -598,7 +598,7 @@ methods:{
this
.
sharedUrl
=
"
http://
"
+
window
.
location
.
host
+
"
/projects/
"
+
this
.
project
.
id
;
console
.
log
(
this
.
project
.
id
);
this
.
status
=
result
.
status
;
if
(
result
.
status
.
worktable
===
"
READY
"
&&
!
this
.
isready
){
if
(
result
.
status
.
metadata
===
"
READY
"
&&
!
this
.
isready
){
await
this
.
$axios
.
$get
(
'
/projects/
'
+
this
.
project
.
id
+
"
/gencov
"
).
then
((
async
function
(
result2
)
{
this
.
gencov
=
result2
;
...
...
jass/models/project.py
View file @
1d64718b
...
...
@@ -218,6 +218,12 @@ class Project(BaseModel, abc.ABC):
def
get_project_summary_statistics
(
self
):
return
get_worktable_summary
(
self
.
get_worktable_path
())
def
get_metadata_file_path
(
self
):
"""
Get the path of the metadata json file
"""
return
os
.
path
.
join
(
self
.
get_folder_path
(),
"metadata.json"
)
def
get_project_nsnps
(
self
):
return
get_inittable_meta
(
self
.
get_worktable_path
())
...
...
@@ -270,6 +276,11 @@ class Project(BaseModel, abc.ABC):
if
filename
.
endswith
(
".png"
):
os
.
remove
(
os
.
path
.
join
(
self
.
get_folder_path
(),
filename
))
have_removed_file
=
True
try
:
os
.
remove
(
self
.
get_metadata_file_path
())
have_removed_file
=
True
except
FileNotFoundError
:
pass
return
have_removed_file
@
call_with_tb
(
'global_manhattan'
)
...
...
@@ -296,6 +307,12 @@ class Project(BaseModel, abc.ABC):
def
create_csv_file
(
self
):
return
create_genome_full_csv
(
self
.
get_worktable_path
(),
self
.
get_csv_path
())
@
call_with_tb
(
'metadata'
)
def
create_project_metadata_file
(
self
):
with
open
(
self
.
get_metadata_file_path
(),
'w'
)
as
f
:
f
.
write
(
json
.
dumps
(
self
.
get_project_nsnps
()))
print
(
"------ metadata -----"
)
class
GlobalProject
(
Project
):
@
call_with_tb
(
'worktable'
)
...
...
jass/server.py
View file @
1d64718b
...
...
@@ -106,7 +106,7 @@ def project_gencov_view(project_id: str):
@
app
.
get
(
"/api/projects/{project_id}/metadata"
)
def
project_metadata
(
project_id
:
str
):
return
load_project
(
project_id
=
project_id
).
get_
project_nsnps
()
return
FileResponse
(
load_project
(
project_id
=
project_id
).
get_
metadata_file_path
()
)
@
app
.
get
(
"/api/projects/{project_id}/globalmanhattan"
)
...
...
jass/tasks.py
View file @
1d64718b
...
...
@@ -79,6 +79,12 @@ def create_project_csv_file(project_id):
return
project
.
create_csv_file
()
@
celery
.
task
def
create_project_metadata_file
(
project_id
):
project
=
GlobalProject
.
load
(
project_id
)
return
project
.
create_project_metadata_file
()
@
celery
.
task
def
dummy_task
():
print
(
"This task to nothing, but help the chain to have a valid status"
)
...
...
@@ -124,6 +130,9 @@ def run_project_analysis_if_needed(project):
if
project
.
get_csv_path
()
and
not
os
.
path
.
exists
(
project
.
get_csv_path
()):
post_worktable_tasks
.
append
(
create_project_csv_file
.
si
(
project
.
id
))
if
project
.
get_metadata_file_path
()
and
not
os
.
path
.
exists
(
project
.
get_metadata_file_path
()):
post_worktable_tasks
.
append
(
create_project_metadata_file
.
si
(
project
.
id
))
if
len
(
tasks
)
+
len
(
post_worktable_tasks
)
==
0
:
return
main_wf
=
chain
(
...
...
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