Commit 9ca5c43e authored by Stanislav Bohm's avatar Stanislav Bohm

FIX: Python3 fixed in rview

parent 21db13a6
from ..pb import loomreport_pb2 as loomreport
from ..pb import loomcomm_pb2 as loomcomm
import gv
from .gv import Graph
import matplotlib.pyplot as plt
......@@ -26,7 +26,7 @@ def dot_color(color):
class Report:
def __init__(self, filename):
with open(filename) as f:
with open(filename, "rb") as f:
raw_data = f.read()
self.report_msg = loomreport.Report()
......@@ -65,7 +65,7 @@ class Report:
def create_graph(self):
TASK_START = loomcomm.Event.TASK_START
graph = gv.Graph()
graph = Graph()
symbols = self.symbols
task_workers = {}
......@@ -134,7 +134,7 @@ class Report:
y_labels.append("Worker {}".format(w_index))
y_labels.extend([""] * len(lst))
for lst2 in lst:
for i in xrange(0, len(lst2), 2):
for i in range(0, len(lst2), 2):
y.append(index)
xmin.append(lst2[i].time)
xmax.append(lst2[i + 1].time)
......
from report import Report
from .report import Report
import argparse
import subprocess
import matplotlib.pyplot as plt
......@@ -38,11 +38,11 @@ def run_program(args, stdin=None):
def show_symbols(report):
for i, symbol in enumerate(report.symbols):
print "{}: {}".format(i, symbol)
print("{}: {}".format(i, symbol))
def show_graph(report):
dot = report.create_graph().make_dot("Plan")
dot = report.create_graph().make_dot("Plan").encode()
run_program(("xdot", "-"), dot)
......
......@@ -21,7 +21,7 @@ def test_py_call(loom_env):
d = tasks.const("12345")
p = tasks.py_call(f, (c, d))
q = tasks.py_call(g)
result1, result2 = loom_env.submit((p, q))
result1, result2 = loom_env.submit((p, q), "report")
assert result1 == b"ABC, 3, 12345, 5"
assert result2 == b"Test"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment