Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Cosy-Bio
Drugst.One
plugin
Commits
92b299f5
Commit
92b299f5
authored
4 years ago
by
Julian Matschinske
Browse files
Options
Downloads
Patches
Plain Diff
Limit number of tasks that can be run at once to 3
parent
cb7701b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/analysis.service.ts
+39
-2
39 additions, 2 deletions
src/app/analysis.service.ts
src/app/components/launch-analysis/launch-analysis.component.html
+7
-1
7 additions, 1 deletion
...components/launch-analysis/launch-analysis.component.html
with
46 additions
and
3 deletions
src/app/analysis.service.ts
+
39
−
2
View file @
92b299f5
...
...
@@ -41,6 +41,7 @@ export class AnalysisService {
public
tasks
:
Task
[]
=
[];
private
intervalId
:
any
;
private
canLaunchNewTask
=
false
;
constructor
(
private
http
:
HttpClient
)
{
const
tokens
=
localStorage
.
getItem
(
'
tokens
'
);
...
...
@@ -147,6 +148,19 @@ export class AnalysisService {
}
async
startQuickAnalysis
()
{
if
(
!
this
.
canLaunchTask
())
{
toast
({
message
:
'
You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list.
'
,
duration
:
5000
,
dismissible
:
true
,
pauseOnHover
:
true
,
type
:
'
is-danger
'
,
position
:
'
top-center
'
,
animate
:
{
in
:
'
fadeIn
'
,
out
:
'
fadeOut
'
}
});
return
;
}
const
resp
=
await
this
.
http
.
post
<
any
>
(
`
${
environment
.
backend
}
task/`
,
{
algorithm
:
'
quick
'
,
target
:
'
drug
'
,
...
...
@@ -171,6 +185,19 @@ export class AnalysisService {
}
async
startAnalysis
(
algorithm
,
target
:
'
drug
'
|
'
drug-target
'
,
parameters
)
{
if
(
!
this
.
canLaunchTask
())
{
toast
({
message
:
'
You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list.
'
,
duration
:
5000
,
dismissible
:
true
,
pauseOnHover
:
true
,
type
:
'
is-danger
'
,
position
:
'
top-center
'
,
animate
:
{
in
:
'
fadeIn
'
,
out
:
'
fadeOut
'
}
});
return
;
}
const
resp
=
await
this
.
http
.
post
<
any
>
(
`
${
environment
.
backend
}
task/`
,
{
algorithm
,
target
,
...
...
@@ -203,13 +230,20 @@ export class AnalysisService {
});
}
public
canLaunchTask
():
boolean
{
return
this
.
canLaunchNewTask
;
}
startWatching
()
{
const
watch
=
async
()
=>
{
if
(
this
.
tokens
.
length
>
0
)
{
this
.
tasks
=
await
this
.
getTasks
();
let
queuedOrRunningTasks
=
0
;
this
.
tasks
.
forEach
((
task
)
=>
{
if
(
this
.
finishedTokens
.
find
((
finishedToken
)
=>
finishedToken
===
task
.
token
))
{
}
else
{
if
(
!
task
.
info
.
done
&&
!
task
.
info
.
failed
)
{
queuedOrRunningTasks
++
;
}
if
(
!
this
.
finishedTokens
.
find
((
finishedToken
)
=>
finishedToken
===
task
.
token
))
{
if
(
task
.
info
.
done
)
{
this
.
finishedTokens
.
push
(
task
.
token
);
this
.
showToast
(
task
,
'
DONE
'
);
...
...
@@ -222,6 +256,9 @@ export class AnalysisService {
}
}
});
this
.
canLaunchNewTask
=
queuedOrRunningTasks
<
3
;
}
else
{
this
.
canLaunchNewTask
=
true
;
}
};
watch
();
...
...
This diff is collapsed.
Click to expand it.
src/app/components/launch-analysis/launch-analysis.component.html
+
7
−
1
View file @
92b299f5
...
...
@@ -28,6 +28,12 @@
</div>
</div>
<div
*ngIf=
"!analysis.canLaunchTask()"
>
<div
class=
"notification is-warning warning"
>
You can only run 3 tasks at once. Please wait for one of them to finish or delete it from the task list.
</div>
</div>
<div
*ngIf=
"algorithm==='trustrank'"
>
<div
class=
"field"
*ngIf=
"target === 'drug'"
>
<label
class=
"label"
>
Indirect Drugs
</label>
...
...
@@ -136,7 +142,7 @@
</section>
<footer
class=
"modal-card-foot"
>
<button
(click)=
"startTask(); close()"
class=
"button is-success is-rounded"
[disabled]=
"target === 'drug' && hasBaits"
>
Launch
</button>
<button
(click)=
"startTask(); close()"
class=
"button is-success is-rounded"
[disabled]=
"
(
target === 'drug' && hasBaits
) || !analysis.canLaunchTask()
"
>
Launch
</button>
<button
(click)=
"close()"
class=
"button is-rounded"
>
Close
</button>
</footer>
</div>
...
...
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