Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Website
Commits
c7668dd8
Commit
c7668dd8
authored
1 year ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Multiple analysis upload: not working for the first time"
parent
65a00aab
No related branches found
No related tags found
1 merge request
!10
Resolve "Multiple analysis upload: not working for the first time"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+9
-0
9 additions, 0 deletions
.gitlab-ci.yml
backend/analysis/api.py
+13
-0
13 additions, 0 deletions
backend/analysis/api.py
backend/analysis/models.py
+21
-15
21 additions, 15 deletions
backend/analysis/models.py
frontend/components/Main.vue
+7
-3
7 additions, 3 deletions
frontend/components/Main.vue
with
50 additions
and
18 deletions
.gitlab-ci.yml
+
9
−
0
View file @
c7668dd8
workflow
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
when
:
never
-
when
:
always
stages
:
stages
:
-
delete-release
-
delete-release
-
build
-
build
...
...
This diff is collapsed.
Click to expand it.
backend/analysis/api.py
+
13
−
0
View file @
c7668dd8
...
@@ -28,6 +28,15 @@ def csrf(request):
...
@@ -28,6 +28,15 @@ def csrf(request):
return
JsonResponse
({
"
token
"
:
token
})
return
JsonResponse
({
"
token
"
:
token
})
@router.get
(
"
init-session
"
)
def
init_session
(
request
):
if
not
request
.
session
.
session_key
:
request
.
session
.
create
()
request
.
session
.
set_expiry
(
60000
)
return
JsonResponse
({
"
session
"
:
"
ok
"
})
@router.post
(
"
add
"
,
response
=
AnalysisOutSchema
)
@router.post
(
"
add
"
,
response
=
AnalysisOutSchema
)
def
add
(
def
add
(
request
,
request
,
...
@@ -42,14 +51,17 @@ def add(
...
@@ -42,14 +51,17 @@ def add(
if
request
.
session
.
session_key
:
if
request
.
session
.
session_key
:
session_key
=
request
.
session
.
session_key
session_key
=
request
.
session
.
session_key
else
:
else
:
print
(
"
should not create a token !!!!!
"
)
request
.
session
.
create
()
request
.
session
.
create
()
request
.
session
.
set_expiry
(
60000
)
request
.
session
.
set_expiry
(
60000
)
session_key
=
request
.
session
.
session_key
session_key
=
request
.
session
.
session_key
print
(
session_key
)
session
=
Session
.
objects
.
get
(
session_key
=
session_key
)
session
=
Session
.
objects
.
get
(
session_key
=
session_key
)
aw
=
AnalysisWorkflow
.
objects
.
get
(
pk
=
1
)
aw
=
AnalysisWorkflow
.
objects
.
get
(
pk
=
1
)
input_files
=
[
input_files
=
[
genome_path
,
genome_path
,
]
]
params
=
{}
params
=
{}
analysis
=
aw
.
invoke
(
session
,
input_files
,
params
,
f
"
{
genomefile
.
name
}
"
)
analysis
=
aw
.
invoke
(
session
,
input_files
,
params
,
f
"
{
genomefile
.
name
}
"
)
...
@@ -57,6 +69,7 @@ def add(
...
@@ -57,6 +69,7 @@ def add(
return
analysis
return
analysis
@router.get
(
"
/
"
,
response
=
list
[
AnalysisOutSchema
])
@router.get
(
"
/
"
,
response
=
list
[
AnalysisOutSchema
])
def
list
(
request
):
def
list
(
request
):
session_key
=
request
.
session
.
session_key
session_key
=
request
.
session
.
session_key
...
...
This diff is collapsed.
Click to expand it.
backend/analysis/models.py
+
21
−
15
View file @
c7668dd8
...
@@ -65,21 +65,27 @@ class AnalysisWorkflow(Workflow):
...
@@ -65,21 +65,27 @@ class AnalysisWorkflow(Workflow):
galaxy_inv
=
self
.
galaxy_workflow
.
invoke
(
galaxy_inv
=
self
.
galaxy_workflow
.
invoke
(
datamap
,
history
=
history
.
galaxy_history
,
params
=
params
datamap
,
history
=
history
.
galaxy_history
,
params
=
params
)
)
analysis
=
Analysis
(
name
=
history_name
,
try
:
galaxy_id
=
galaxy_inv
.
id
,
analysis
=
Analysis
(
galaxy_state
=
galaxy_inv
.
state
,
name
=
history_name
,
analysis_workflow
=
self
,
galaxy_id
=
galaxy_inv
.
id
,
workflow
=
self
,
galaxy_state
=
galaxy_inv
.
state
,
history
=
history
,
analysis_workflow
=
self
,
analysis_history
=
history
,
workflow
=
self
,
params
=
params
,
history
=
history
,
datamap
=
datamap
,
analysis_history
=
history
,
create_time
=
load_galaxy_invocation_time_to_datetime
(
galaxy_inv
),
params
=
params
,
)
datamap
=
datamap
,
analysis
.
save
()
create_time
=
load_galaxy_invocation_time_to_datetime
(
galaxy_inv
),
analysis
.
create_output_files
()
)
return
analysis
except
ZeroDivisionError
as
e
:
print
(
e
)
finally
:
analysis
.
save
()
analysis
.
create_output_files
(
max_retry
=
20
)
return
analysis
def
prepare_invocation
(
def
prepare_invocation
(
self
,
self
,
...
...
This diff is collapsed.
Click to expand it.
frontend/components/Main.vue
+
7
−
3
View file @
c7668dd8
...
@@ -6,12 +6,16 @@ export interface Props {
...
@@ -6,12 +6,16 @@ export interface Props {
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
fluid
:
true
fluid
:
true
});
});
useCsrfToken
()
const
{
csrfToken
}
=
await
useCsrfToken
()
// init session
if
(
csrfToken
.
value
)
{
const
{
data
,
pending
,
error
}
=
useFetch
(
"
/api/analysis/init-session
"
,
{
headers
:
[[
"
X-CSRFToken
"
,
csrfToken
.
value
]]
})
}
const
scrollThreshold
=
ref
(
200
)
const
scrollThreshold
=
ref
(
200
)
const
density
=
ref
<
'
compact
'
|
'
prominent
'
>
(
"
prominent
"
)
const
density
=
ref
<
'
compact
'
|
'
prominent
'
>
(
"
prominent
"
)
// Hanle CSRF token
function
onScroll
()
{
function
onScroll
()
{
if
(
window
.
scrollY
>
scrollThreshold
.
value
)
{
if
(
window
.
scrollY
>
scrollThreshold
.
value
)
{
density
.
value
=
"
compact
"
density
.
value
=
"
compact
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment