Browse Source

Allow for choosing output graph name on stop

check-vt100
Aleksander Kiryk 4 years ago committed by Aleksander Kiryk
parent
commit
b95d612a00
  1. 6
      sargraph.py
  2. 23
      watch.py

6
sargraph.py

@ -79,10 +79,10 @@ elif cmd[0] == "stop":
except:
print("Warning: cannot find pid.")
gpid = -1
if len(cmd) >= 2 and cmd[1] == "none":
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "command:b\n"])
if len(cmd) < 2:
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "command:q:\n"])
else:
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", "command:q\n"])
p = subprocess.Popen(["screen", "-S", sid, "-X", "stuff", f"command:q:{cmd[1]}\n"])
while p.poll() is None:
time.sleep(0.1)
if gpid == -1:

23
watch.py

@ -156,7 +156,18 @@ def watch(session, fsdev):
label_line = sys.stdin.readline().replace("\n", "")
if label_line.startswith("command:"):
label_line = label_line[len("command:"):]
if label_line == "q":
if label_line.startswith("q:"):
label_line = label_line[len("q:"):]
summarize(session)
if label_line == "none":
pass
elif label_line:
import graph
graph.graph(session, label_line)
elif not dont_plot:
import graph
graph.graph(session)
die = 1
break
elif label_line.startswith("s:"):
@ -171,10 +182,6 @@ def watch(session, fsdev):
graph.graph(session)
else:
graph.graph(session, label_line)
elif label_line == "b":
dont_plot = True
die = 1
break
elif label_line.startswith('label:'):
label_line = label_line[len('label:'):]
with open(f"{session}.txt", "a") as f:
@ -235,9 +242,3 @@ def watch(session, fsdev):
if SAMPLE_NUMBER == 0:
time.sleep(1)
sys.exit(0)
summarize(session)
if not dont_plot:
import graph
graph.graph(session)

Loading…
Cancel
Save