Skip to content

Commit 746494f

Browse files
committed
Fixed multi typing reset bug occuring when process is killed durich attaching step
1 parent 7e3531a commit 746494f

File tree

2 files changed

+67
-35
lines changed

2 files changed

+67
-35
lines changed

App.R

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6131,14 +6131,16 @@ server <- function(input, output, session) {
61316131
title = "Pending Multi Typing",
61326132
type = "warning",
61336133
position = "top-end",
6134-
timer = 6000
6134+
timer = 6000,
6135+
width = "500px"
61356136
)
61366137
} else if(readLines(paste0(getwd(), "/execute", "/progress.fifo"))[1] != "0") {
61376138
show_toast(
61386139
title = "Pending Single Typing",
61396140
type = "warning",
61406141
position = "top-end",
6141-
timer = 6000
6142+
timer = 6000,
6143+
width = "500px"
61426144
)
61436145
} else {
61446146
showModal(
@@ -8834,7 +8836,7 @@ server <- function(input, output, session) {
88348836
title = "Invalid scheme folder",
88358837
type = "warning",
88368838
position = "top-end",
8837-
width = "350px",
8839+
width = "500px",
88388840
timer = 4000
88398841
)
88408842
}
@@ -9417,7 +9419,7 @@ server <- function(input, output, session) {
94179419
title = "Max. 10 characters",
94189420
type = "warning",
94199421
position = "top-end",
9420-
width = "400px",
9422+
width = "500px",
94219423
timer = 6000
94229424
)
94239425
} else {
@@ -9426,7 +9428,7 @@ server <- function(input, output, session) {
94269428
title = "Min. 1 character",
94279429
type = "error",
94289430
position = "top-end",
9429-
width = "330px",
9431+
width = "500px",
94309432
timer = 6000
94319433
)
94329434
} else {
@@ -9435,7 +9437,7 @@ server <- function(input, output, session) {
94359437
title = "Variable name already existing",
94369438
type = "warning",
94379439
position = "top-end",
9438-
width = "400px",
9440+
width = "500px",
94399441
timer = 6000
94409442
)
94419443
} else {
@@ -9493,7 +9495,7 @@ server <- function(input, output, session) {
94939495
title = paste0("Variable ", trimws(input$new_var_name), " added"),
94949496
type = "success",
94959497
position = "top-end",
9496-
width = "370px",
9498+
width = "500px",
94979499
timer = 6000
94989500
)
94999501

@@ -9505,7 +9507,7 @@ server <- function(input, output, session) {
95059507
title = "No custom variables",
95069508
type = "error",
95079509
position = "top-end",
9508-
width = "330px",
9510+
width = "500px",
95099511
timer = 6000
95109512
)
95119513
} else {
@@ -9541,7 +9543,7 @@ server <- function(input, output, session) {
95419543
title = paste0("Variable ", input$del_which_var, " removed"),
95429544
type = "warning",
95439545
position = "top-end",
9544-
width = "370px",
9546+
width = "500px",
95459547
timer = 6000
95469548
)
95479549

@@ -9753,7 +9755,8 @@ server <- function(input, output, session) {
97539755
title = "Database successfully saved",
97549756
type = "success",
97559757
position = "top-end",
9756-
timer = 4000
9758+
timer = 4000,
9759+
width = "500px"
97579760
)
97589761
})
97599762

@@ -9763,7 +9766,8 @@ server <- function(input, output, session) {
97639766
title = "No entry selected",
97649767
type = "warning",
97659768
position = "top-end",
9766-
timer = 4000
9769+
timer = 4000,
9770+
width = "500px"
97679771
)
97689772
} else {
97699773
if( (length(input$select_delete) - nrow(DF1$data) ) == 0) {
@@ -9857,14 +9861,16 @@ server <- function(input, output, session) {
98579861
title = "Entries deleted",
98589862
type = "success",
98599863
position = "top-end",
9860-
timer = 4000
9864+
timer = 4000,
9865+
width = "500px"
98619866
)
98629867
} else {
98639868
show_toast(
98649869
title = "Entry deleted",
98659870
type = "success",
98669871
position = "top-end",
9867-
timer = 4000
9872+
timer = 4000,
9873+
width = "500px"
98689874
)
98699875
}
98709876
})
@@ -10241,7 +10247,8 @@ server <- function(input, output, session) {
1024110247
title = "Download successful",
1024210248
type = "success",
1024310249
position = "top-end",
10244-
timer = 5000
10250+
timer = 5000,
10251+
width = "500px"
1024510252
)
1024610253

1024710254
showModal(
@@ -12825,14 +12832,16 @@ server <- function(input, output, session) {
1282512832
title = "Missing data",
1282612833
type = "error",
1282712834
position = "top-end",
12828-
timer = 6000
12835+
timer = 6000,
12836+
width = "500px"
1282912837
)
1283012838
} else if(nrow(DF1$allelic_profile_true) < 3) {
1283112839
show_toast(
1283212840
title = "Min. of 3 entries required for visualization",
1283312841
type = "error",
1283412842
position = "top-end",
12835-
timer = 6000
12843+
timer = 6000,
12844+
width = "500px"
1283612845
)
1283712846
} else {
1283812847

@@ -12914,7 +12923,7 @@ server <- function(input, output, session) {
1291412923
title = "Computation might take a while",
1291512924
type = "warning",
1291612925
position = "top-end",
12917-
width = "400px",
12926+
width = "500px",
1291812927
timer = 10000
1291912928
)
1292012929
}
@@ -13380,7 +13389,7 @@ server <- function(input, output, session) {
1338013389
title = "Wrong file type (only fasta/fna/fa)",
1338113390
type = "error",
1338213391
position = "top-end",
13383-
width = "400px",
13392+
width = "500px",
1338413393
timer = 6000
1338513394
)
1338613395
}
@@ -13410,7 +13419,8 @@ server <- function(input, output, session) {
1341013419
title = "Pending Multi Typing",
1341113420
type = "warning",
1341213421
position = "top-end",
13413-
timer = 6000
13422+
timer = 6000,
13423+
width = "500px"
1341413424
)
1341513425
} else {
1341613426
if(!is.null(DF1$data)) {
@@ -13448,7 +13458,8 @@ server <- function(input, output, session) {
1344813458
title = "Typing Initiated",
1344913459
type = "success",
1345013460
position = "top-end",
13451-
timer = 12000
13461+
timer = 12000,
13462+
width = "500px"
1345213463
)
1345313464

1345413465
### Run KMA Typing
@@ -13478,10 +13489,10 @@ server <- function(input, output, session) {
1347813489
br(), br(),
1347913490
column(width = 1),
1348013491
column(
13481-
width = 2,
13492+
width = 3,
1348213493
h3(p("Pending Single Typing ..."), style = "color:white")
1348313494
),
13484-
br(), br(), br(),
13495+
br(), br(), br(),
1348513496
fluidRow(
1348613497
column(width = 1),
1348713498
column(
@@ -13637,7 +13648,8 @@ server <- function(input, output, session) {
1363713648
title = "Metadata declared",
1363813649
type = "success",
1363913650
position = "top-end",
13640-
timer = 3000
13651+
timer = 3000,
13652+
width = "500px"
1364113653
)
1364213654

1364313655
# Render Start Typing UI
@@ -13736,7 +13748,8 @@ server <- function(input, output, session) {
1373613748
title = "Single Typing finalized",
1373713749
type = "success",
1373813750
position = "top-end",
13739-
timer = 8000
13751+
timer = 8000,
13752+
width = "500px"
1374013753
)
1374113754
typing_reactive$single_end <- TRUE
1374213755
}
@@ -14020,7 +14033,8 @@ server <- function(input, output, session) {
1402014033
title = "Metadata declared",
1402114034
type = "success",
1402214035
position = "top-end",
14023-
timer = 3000
14036+
timer = 3000,
14037+
width = "500px"
1402414038
)
1402514039

1402614040
output$start_multi_typing_ui <- renderUI({
@@ -14140,7 +14154,8 @@ server <- function(input, output, session) {
1414014154
title = "Execution cancelled",
1414114155
type = "warning",
1414214156
position = "top-end",
14143-
timer = 6000
14157+
timer = 6000,
14158+
width = "500px"
1414414159
)
1414514160

1414614161
# Kill multi typing and reset logfile
@@ -14198,7 +14213,8 @@ server <- function(input, output, session) {
1419814213
title = "Pending Single Typing",
1419914214
type = "warning",
1420014215
position = "top-end",
14201-
timer = 6000
14216+
timer = 6000,
14217+
width = "500px"
1420214218
)
1420314219
} else {
1420414220
if (any(!grepl("\\.fasta|\\.fna|\\.fa", str_sub(typing_reactive$genome_selected$Files[which(typing_reactive$genome_selected$Include == TRUE)], start = -6)))) {
@@ -14207,8 +14223,8 @@ server <- function(input, output, session) {
1420714223
title = "Wrong file type (include only fasta/fna/fa)",
1420814224
type = "error",
1420914225
position = "top-end",
14210-
width = "400px",
14211-
timer = 6000
14226+
timer = 6000,
14227+
width = "500px"
1421214228
)
1421314229
} else {
1421414230
showModal(
@@ -14242,7 +14258,8 @@ server <- function(input, output, session) {
1424214258
title = "Multi Typing started",
1424314259
type = "success",
1424414260
position = "top-end",
14245-
timer = 6000
14261+
timer = 6000,
14262+
width = "500px"
1424614263
)
1424714264

1424814265
typing_reactive$final <- FALSE
@@ -14354,7 +14371,8 @@ server <- function(input, output, session) {
1435414371
title = "Multi Typing finalized",
1435514372
type = "success",
1435614373
position = "top-end",
14357-
timer = 8000
14374+
timer = 8000,
14375+
width = "500px"
1435814376
)
1435914377
typing_reactive$final <- TRUE
1436014378
}

execute/kill_multi.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22
unset R_HOME
33

44
log_file='execute/script_log.txt'
5-
TARGET_SCRIPT='execute/kma_multi.sh'
5+
kma_multi='execute/kma_multi.sh'
6+
automatic_typing='automatic_typing.R'
7+
68
# Function to log messages to the file
79
log_message() {
810
echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" >> "$log_file"
911
}
12+
13+
# Find the process ID (PID) of the script
14+
PID=$(pgrep -f "$kma_multi")
15+
if [ -z "$PID" ]; then
16+
echo "No process found for $kma_multi"
17+
else
18+
# Kill the process
19+
echo "Killing process $PID for $kma_multi"
20+
kill "$PID"
21+
fi
22+
1023
# Find the process ID (PID) of the script
11-
PID=$(pgrep -f "$TARGET_SCRIPT")
24+
PID=$(pgrep -f "$automatic_typing")
1225
if [ -z "$PID" ]; then
13-
echo "No process found for $TARGET_SCRIPT"
26+
echo "No process found for $automatic_typing"
1427
else
1528
# Kill the process
16-
echo "Killing process $PID for $TARGET_SCRIPT"
29+
echo "Killing process $PID for $automatic_typing"
1730
kill "$PID"
1831
fi
32+
1933
echo 0 > $log_file

0 commit comments

Comments
 (0)