Skip to content

Commit

Permalink
All the GUI parts done and saves to scenario file
Browse files Browse the repository at this point in the history
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
  • Loading branch information
damies13 committed Aug 21, 2023
1 parent 32d0f4c commit ed3a870
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
4 changes: 4 additions & 0 deletions rfswarm_agent/rfswarm_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']))

Expand Down
73 changes: 72 additions & 1 deletion rfswarm_manager/rfswarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{}]
Expand Down Expand Up @@ -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"))''')
Expand Down Expand Up @@ -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"])

Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"] = []
Expand Down

0 comments on commit ed3a870

Please sign in to comment.