From ed3a8700a7e44eec827997487ea035db624d74f9 Mon Sep 17 00:00:00 2001 From: damies13 Date: Mon, 21 Aug 2023 14:38:50 +1000 Subject: [PATCH] All the GUI parts done and saves to scenario file Including the setting in the job data for agent agent code to read from jobdata Now just need to do some testing to make sure it's all working Issue #133 --- rfswarm_agent/rfswarm_agent.py | 4 ++ rfswarm_manager/rfswarm.py | 73 +++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/rfswarm_agent/rfswarm_agent.py b/rfswarm_agent/rfswarm_agent.py index 30d9e141a..559b7b9a9 100644 --- a/rfswarm_agent/rfswarm_agent.py +++ b/rfswarm_agent/rfswarm_agent.py @@ -901,6 +901,10 @@ def runthread(self, jobid): if not self.xmlmode: cmd.append("--listener {}".format('"' + self.listenerfile + '"')) + if "TestRepeater" in self.jobs[jobid]: + if self.str2bool(self.jobs[jobid]["TestRepeater"]): + cmd.append("--listener {}".format('"' + self.repeaterfile + '"')) + if "robotoptions" in self.jobs[jobid]: cmd.append("{}".format(self.jobs[jobid]['robotoptions'])) diff --git a/rfswarm_manager/rfswarm.py b/rfswarm_manager/rfswarm.py index 2595b9373..9923122dc 100644 --- a/rfswarm_manager/rfswarm.py +++ b/rfswarm_manager/rfswarm.py @@ -458,6 +458,7 @@ class RFSwarmBase: # https://github.com/damies13/rfswarm/blob/master/Doc/rfswarm_manager.md#exclude-libraries # default (BuiltIn,String,OperatingSystem,perftest) excludelibrariesdefault = "BuiltIn,String,OperatingSystem,perftest" + testrepeaterdefault = False scriptcount = 0 scriptlist: Any = [{}] @@ -804,7 +805,7 @@ def ensure_db(self): # create tables c.execute('''CREATE TABLE Results - (script_index int, robot int, iteration int, agent text, sequence int, result_name text, result text, elapsed_time num, start_time num, end_time num)''') + (script_index int, robot int, iteration real, agent text, sequence int, result_name text, result text, elapsed_time num, start_time num, end_time num)''') c.execute('''CREATE TABLE Metric (ID INTEGER, Name TEXT NOT NULL, Type TEXT NOT NULL, PRIMARY KEY("ID"))''') @@ -2993,6 +2994,13 @@ def run_start_threads(self): if "robotoptions" in base.scriptdefaults: base.robot_schedule["Agents"][nxtagent][grurid]["robotoptions"] = base.scriptdefaults["robotoptions"] + tr = base.testrepeaterdefault + if "testrepeater" in base.scriptdefaults: + tr = base.scriptdefaults["testrepeater"] + if "testrepeater" in grp: + tr = grp["testrepeater"] + base.robot_schedule["Agents"][nxtagent][grurid]["robotoptions"] = str(tr) + base.Agents[nxtagent]["AssignedRobots"] += 1 base.debugmsg(5, "base.Agents[", nxtagent, "][AssignedRobots]:", base.Agents[nxtagent]["AssignedRobots"]) @@ -4956,6 +4964,13 @@ def setings_open(self, _event=None): setingsWindow.robotoptionscurrent = base.scriptdefaults["robotoptions"] base.debugmsg(5, "robotoptionscurrent:", setingsWindow.robotoptionscurrent) + setingsWindow.testrepeaterdefault = base.testrepeaterdefault + setingsWindow.testrepeatercurrent = setingsWindow.testrepeaterdefault + if "testrepeater" in base.scriptdefaults: + setingsWindow.testrepeatercurrent = base.str2bool(base.scriptdefaults["testrepeater"]) + base.debugmsg(5, "testrepeatercurrent:", setingsWindow.testrepeatercurrent) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Scenario # @@ -5020,6 +5035,15 @@ def setings_open(self, _event=None): setingsWindow.inpRO.insert(0, setingsWindow.robotoptionscurrent) setingsWindow.inpRO.grid(column=1, row=rownum, columnspan=10, sticky="nsew") + rownum += 1 + setingsWindow.lblTR = ttk.Label(setingsWindow.fmeTestDefaults, text="Test Repeater:") + setingsWindow.lblTR.grid(column=0, row=rownum, sticky="nsew") + + setingsWindow.boolTR = tk.BooleanVar() + setingsWindow.boolTR.set(setingsWindow.testrepeatercurrent) + setingsWindow.inpTR = tk.Checkbutton(setingsWindow.fmeTestDefaults, variable=setingsWindow.boolTR, onvalue=True, offvalue=False) + setingsWindow.inpTR.grid(column=1, row=rownum, sticky="nsew") + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Manager # @@ -5178,6 +5202,18 @@ def setings_close(self, setingsWindow, save): del base.scriptdefaults["robotoptions"] self.plan_scnro_chngd = True + # base.scriptdefaults["testrepeater"] + tr = setingsWindow.boolTR.get() + base.debugmsg(7, "tr:", tr) + # setingsWindow.testrepeatercurrent = setingsWindow.testrepeaterdefault + if tr != setingsWindow.testrepeaterdefault: + base.scriptdefaults["testrepeater"] = str(tr) + self.plan_scnro_chngd = True + else: + if "testrepeater" in base.scriptdefaults: + del base.scriptdefaults["testrepeater"] + self.plan_scnro_chngd = True + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Manager # @@ -6088,6 +6124,15 @@ def sr_row_settings(self, r): stgsWindow.robotoptionscurrent = base.scriptlist[r]["robotoptions"] base.debugmsg(5, "robotoptionscurrent:", stgsWindow.robotoptionscurrent) + stgsWindow.testrepeaterdefault = base.testrepeaterdefault + if "testrepeater" in base.scriptdefaults: + stgsWindow.testrepeaterdefault = base.str2bool(base.scriptdefaults["testrepeater"]) + + stgsWindow.testrepeatercurrent = stgsWindow.testrepeaterdefault + if "testrepeater" in base.scriptlist[r]: + stgsWindow.testrepeatercurrent = base.str2bool(base.scriptlist[r]["testrepeater"]) + base.debugmsg(5, "testrepeatercurrent:", stgsWindow.testrepeatercurrent) + row = 0 stgsWindow.lblBLNK = ttk.Label(stgsWindow, text=" ") # just a blank row as a spacer before the filters stgsWindow.lblBLNK.grid(column=0, row=row, sticky="nsew") @@ -6120,6 +6165,19 @@ def sr_row_settings(self, r): stgsWindow.lblBLNK = ttk.Label(stgsWindow, text=" ") # just a blank row as a spacer before the filters stgsWindow.lblBLNK.grid(column=0, row=row, sticky="nsew") + row += 1 + stgsWindow.lblTR = ttk.Label(stgsWindow, text="Test Repeater:") + stgsWindow.lblTR.grid(column=0, row=row, sticky="nsew") + + stgsWindow.boolTR = tk.BooleanVar() + stgsWindow.boolTR.set(stgsWindow.testrepeatercurrent) + stgsWindow.inpTR = tk.Checkbutton(stgsWindow, variable=stgsWindow.boolTR, onvalue=True, offvalue=False) + stgsWindow.inpTR.grid(column=1, row=row, sticky="nsew") + + row += 1 + stgsWindow.lblBLNK = ttk.Label(stgsWindow, text=" ") # just a blank row as a spacer before the filters + stgsWindow.lblBLNK.grid(column=0, row=row, sticky="nsew") + row += 1 stgsWindow.lblAF = ttk.Label(stgsWindow, text="Agent Filter:") stgsWindow.lblAF.grid(column=0, row=row, sticky="nsew") @@ -6180,6 +6238,19 @@ def sr_row_settings_save(self, r, stgsWindow): del base.scriptlist[r]["robotoptions"] self.plan_scnro_chngd = True + + tr = stgsWindow.boolTR.get() + base.debugmsg(7, "tr:", tr) + if tr != stgsWindow.testrepeaterdefault: + base.scriptlist[r]["testrepeater"] = str(tr) + self.plan_scnro_chngd = True + else: + if "testrepeater" in base.scriptlist[r]: + del base.scriptlist[r]["testrepeater"] + self.plan_scnro_chngd = True + + + base.debugmsg(7, "stgsWindow.Filters:", stgsWindow.Filters) if len(stgsWindow.Filters.keys()) > 0: base.scriptlist[r]["filters"] = []