Commit 099562cf authored by Stanislav Bohm's avatar Stanislav Bohm

RF: New directory layout for Python packages

parent 078f33ac
#!/bin/sh
BASE_DIR=`dirname $0`
BASE_DIR=`dirname $0`/..
LIBLOOM_DIR=${BASE_DIR}/../libloom
WORKER_DIR=${BASE_DIR}/../worker
CLIENT_DIR=${BASE_DIR}/../client
LIBLOOM_DIR=${BASE_DIR}/src/libloom
PYTHON_DIR=${BASE_DIR}/python/loom/pb
# LIBLOOM
protoc loomcomm.proto --cpp_out=${LIBLOOM_DIR}
......@@ -12,7 +11,7 @@ protoc loomplan.proto --cpp_out=${LIBLOOM_DIR}
protoc loomrun.proto --cpp_out=${LIBLOOM_DIR}/tasks
# CLIENT (Python)
protoc loomcomm.proto --python_out=${CLIENT_DIR}
protoc loomplan.proto --python_out=${CLIENT_DIR}
protoc loomrun.proto --python_out=${CLIENT_DIR}
protoc loomreport.proto --python_out=${CLIENT_DIR}
protoc loomcomm.proto --python_out=${PYTHON_DIR}
protoc loomplan.proto --python_out=${PYTHON_DIR}
protoc loomrun.proto --python_out=${PYTHON_DIR}
protoc loomreport.proto --python_out=${PYTHON_DIR}
from loomcomm_pb2 import Register, Data, ClientMessage, ClientSubmit
from loomreport_pb2 import Report
from ..pb.loomcomm_pb2 import Register, Data, ClientMessage, ClientSubmit
from ..pb.loomreport_pb2 import Report
import socket
from connection import Connection
......
import loomplan_pb2
from ..pb import loomplan_pb2 as loomplan
POLICY_STANDARD = loomplan_pb2.Task.POLICY_STANDARD
POLICY_SIMPLE = loomplan_pb2.Task.POLICY_SIMPLE
POLICY_SCHEDULER = loomplan_pb2.Task.POLICY_SCHEDULER
POLICY_STANDARD = loomplan.Task.POLICY_STANDARD
POLICY_SIMPLE = loomplan.Task.POLICY_SIMPLE
POLICY_SCHEDULER = loomplan.Task.POLICY_SCHEDULER
class Task(object):
......
......@@ -3,7 +3,7 @@ from .plan import Plan, Task, ResourceRequest
from .plan import POLICY_SCHEDULER, POLICY_SIMPLE
import struct
import loomrun_pb2
from ..pb import loomrun_pb2 as loomrun
def cpus(value):
......@@ -102,7 +102,7 @@ class PlanBuilder(object):
task.task_type = self.TASK_RUN
task.inputs = tuple(i for i, fname in inputs)
msg = loomrun_pb2.Run()
msg = loomrun.Run()
msg.args.extend(args)
msg.map_inputs.extend(fname if fname else "+in"
......
# HACK! We need to fix this
import sys
import os
sys.path.insert(0,
os.path.join(
os.path.dirname(__file__),
"..",
"client"))
import loomreport_pb2 # noqa
import loomcomm_pb2 # noqa
import gv # noqas
import matplotlib.pyplot as plt # noqa
from ..pb import loomreport_pb2 as loomreport
from ..pb import loomcomm_pb2 as loomcomm
import gv
import matplotlib.pyplot as plt
def generate_colors(count):
......@@ -38,7 +29,7 @@ class Report:
with open(filename) as f:
raw_data = f.read()
self.report_msg = loomreport_pb2.Report()
self.report_msg = loomreport.Report()
self.report_msg.ParseFromString(raw_data)
self.symbols = [s.replace("loom", "L")
......@@ -56,7 +47,7 @@ class Report:
return sorted(labels)
def create_graph(self):
TASK_START = loomcomm_pb2.Event.TASK_START
TASK_START = loomcomm.Event.TASK_START
graph = gv.Graph()
symbols = self.symbols
......@@ -85,8 +76,8 @@ class Report:
return graph
def get_events_hline_data(self):
TASK_START = loomcomm_pb2.Event.TASK_START
TASK_END = loomcomm_pb2.Event.TASK_END
TASK_START = loomcomm.Event.TASK_START
TASK_END = loomcomm.Event.TASK_END
workers = {}
symbols = self.symbols
......
......@@ -5,7 +5,6 @@ import os
IRIS_DATA = os.path.join(LOOM_TEST_DATA_DIR, "iris.data")
loom_env # silence flake8
import client # noqa
def test_cv_iris(loom_env):
......@@ -47,5 +46,3 @@ def test_cv_iris(loom_env):
assert len(results) == CHUNKS
for line in results:
assert line.startswith("Accuracy = ")
#p.write_dot("test.dot", loom_env.client.info)
......@@ -3,7 +3,7 @@ from loomenv import loom_env, LOOM_TESTPROG, LOOM_TEST_DATA_DIR # noqa
import struct
from datetime import datetime
import os
import client
from loom import client
FILE1 = os.path.join(LOOM_TEST_DATA_DIR, "file1")
FILE2 = os.path.join(LOOM_TEST_DATA_DIR, "file2")
......
from loomenv import loom_env, LOOM_TESTPROG, LOOM_TEST_DATA_DIR # noqa
import client
from loom import client
import pytest
loom_env # silence flake8
......
......@@ -13,15 +13,15 @@ LOOM_BUILD = os.path.join(LOOM_ROOT, "_build")
LOOM_SERVER_BIN = os.path.join(LOOM_BUILD, "src", "server", "loom-server")
LOOM_WORKER_BIN = os.path.join(LOOM_BUILD, "src", "worker", "loom-worker")
LOOM_CLIENT = os.path.join(LOOM_ROOT, "src")
LOOM_PYTHON = os.path.join(LOOM_ROOT, "python")
LOOM_TEST_BUILD_DIR = os.path.join(LOOM_TESTDIR, "build")
LOOM_TESTPROG = os.path.join(LOOM_TESTDIR, "testprog.py")
LOOM_TEST_DATA_DIR = os.path.join(LOOM_TESTDIR, "testdata")
sys.path.insert(0, LOOM_CLIENT)
sys.path.insert(0, LOOM_PYTHON)
import client # noqa
import loom.client as client # noqa
VALGRIND = False
......
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