Skip to content

Commit

Permalink
Tools: add --core to solution_status_change.py
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Oct 22, 2024
1 parent a22e28c commit 8347a86
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Tools/scripts/solution_status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@


class SolutionStatusChange(object):
def __init__(self, master):
def __init__(self, master, core=None):
self.master = master
self.core = core
if self.core is not None:
self.core = set(self.core)

def progress(self, text):
'''emit text with possible timestamps etc'''
Expand Down Expand Up @@ -53,13 +56,13 @@ def run(self):
old_message_per_core = {}
while True:
m = self.conn.recv_match(type=desired_type)
if m.C != 0:
continue
if m is None:
break
if m.C not in old_message_per_core:
old_message_per_core[m.C] = m
continue
if self.core is not None and m.C not in self.core:
continue
current = old_message_per_core[m.C]
if m.SS == current.SS:
continue
Expand All @@ -86,6 +89,9 @@ def run(self):
if __name__ == '__main__':
parser = optparse.OptionParser("solution-status-change.py [options]")

parser.add_option("", "--core", action="append", type="int",
default=[], help="core to show (default is all)")

(opts, args) = parser.parse_args()

if len(args) < 1:
Expand All @@ -94,5 +100,8 @@ def run(self):

master = args[0]

tester = SolutionStatusChange(master)
if len(opts.core) == 0:
opts.core = None

tester = SolutionStatusChange(master, core=opts.core)
tester.run()

0 comments on commit 8347a86

Please sign in to comment.