From cecfbd378abdc39c38956fe23b5120c5eb2535c3 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 25 Apr 2024 13:03:56 -0400 Subject: [PATCH 1/5] Update SQL command to get more accurate count of running processes --- .../main/java/jpl/cws/core/db/SchedulerDbService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java b/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java index 7dd9c353..98db043f 100644 --- a/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java +++ b/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java @@ -400,8 +400,8 @@ public int getCountForClaimedProcInstPerKey(String procDefKey, List clai public List> getProcDefKeyLatestCompleteInst(String procDefKey) { return jdbcTemplate.queryForList( - "SELECT proc_inst_id, start_time, end_time FROM cws_proc_inst_status WHERE proc_def_key=? AND status='complete' ORDER BY start_time DESC LIMIT 1", - new Object[]{procDefKey} + "SELECT proc_inst_id, start_time, end_time FROM cws_proc_inst_status WHERE proc_def_key=? AND status='complete' ORDER BY start_time DESC LIMIT 1", + new Object[]{procDefKey} ); } @@ -604,8 +604,10 @@ public int getNumUpWorkers() { */ public List> getWorkerNumRunningProcs() { return jdbcTemplate.queryForList( - "SELECT cws_worker.id, active_count as cnt " + - "FROM cws_worker"); + "SELECT cws_worker.id, COUNT(*) AS cnt FROM cws_proc_inst_status," + + "cws_worker,cws_sched_worker_proc_inst WHERE cws_worker.id = cws_sched_worker_proc_inst.claimed_by_worker" + + " AND cws_sched_worker_proc_inst.proc_inst_id = cws_proc_inst_status.proc_inst_id AND " + + "cws_proc_inst_status.status NOT LIKE '%complete%' GROUP BY cws_worker.id"); } From 73c7fa6df5e822b67a5e9146554309ad1ac53405 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 2 May 2024 12:52:56 -0400 Subject: [PATCH 2/5] Update SystemLevelTestIT to check for "Idle" instead of "0 running". --- .../java/jpl/cws/test/integration/ui/SystemLevelTestIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/SystemLevelTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/SystemLevelTestIT.java index fb94b15b..d48895aa 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/SystemLevelTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/SystemLevelTestIT.java @@ -63,7 +63,7 @@ public void runWorkerTest() throws IOException { log.info("Checking if 1 worker is up, 0 are down, and none are running..."); if (findOnPage("1 Workers (1 up, 0 down)") - && findOnPage("0 running")) { + && findOnPage("Idle")) { log.info("SUCCESS: 1 worker is up, 0 are down, and none are running."); WebElement myTable = driver.findElement(By.id("workers-table")); List myRows = myTable.findElements(By.tagName("td")); From 31a1848797627d15e2258d7e00bd24bf93eea046 Mon Sep 17 00:00:00 2001 From: Will Gunter Date: Thu, 2 May 2024 13:03:07 -0400 Subject: [PATCH 3/5] Update test_workers_page.bpmn to wait longer --- .../resources/bpmn/test_workers_page.bpmn | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/cws-test/src/test/resources/bpmn/test_workers_page.bpmn b/cws-test/src/test/resources/bpmn/test_workers_page.bpmn index 08c4a375..96000f45 100644 --- a/cws-test/src/test/resources/bpmn/test_workers_page.bpmn +++ b/cws-test/src/test/resources/bpmn/test_workers_page.bpmn @@ -23,9 +23,11 @@ - sleep 30 + sleep 192 + + + . - 0 @@ -99,6 +101,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -113,35 +140,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - From b872419467911a1cf74415ff7c2037fc793a9079 Mon Sep 17 00:00:00 2001 From: wcgunter Date: Thu, 2 May 2024 14:10:01 -0400 Subject: [PATCH 4/5] Remove wait time for process (not sure why we are waiting here) --- .../test/java/jpl/cws/test/integration/ui/WorkersTestIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/WorkersTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/WorkersTestIT.java index 09b64d32..b429a6c3 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/WorkersTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/WorkersTestIT.java @@ -35,7 +35,7 @@ public void runWorkersPageTest() { gotoLoginPage(); login(); goToPage("deployments"); - startProcDef("test_workers_page", "Test Workers Page", 30000); + startProcDef("test_workers_page", "Test Workers Page", 0); runNumberActiveTest(); runThreadLimitTest(); runWorkersCheckBoxTest(); From 4d6b5afdaa0dde60bbe0d5e8ff1131cfa0cc958c Mon Sep 17 00:00:00 2001 From: wcgunter Date: Thu, 9 May 2024 15:14:17 -0400 Subject: [PATCH 5/5] Potential change? --- .../src/main/java/jpl/cws/core/db/SchedulerDbService.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java b/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java index 98db043f..c53ea0e3 100644 --- a/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java +++ b/cws-core/src/main/java/jpl/cws/core/db/SchedulerDbService.java @@ -604,10 +604,8 @@ public int getNumUpWorkers() { */ public List> getWorkerNumRunningProcs() { return jdbcTemplate.queryForList( - "SELECT cws_worker.id, COUNT(*) AS cnt FROM cws_proc_inst_status," + - "cws_worker,cws_sched_worker_proc_inst WHERE cws_worker.id = cws_sched_worker_proc_inst.claimed_by_worker" + - " AND cws_sched_worker_proc_inst.proc_inst_id = cws_proc_inst_status.proc_inst_id AND " + - "cws_proc_inst_status.status NOT LIKE '%complete%' GROUP BY cws_worker.id"); + "SELECT cws_worker.id, COUNT(*) AS cnt FROM cws_proc_inst_status,cws_worker " + + "WHERE cws_proc_inst_status.status NOT LIKE '%complete%' GROUP BY cws_worker.id"); }