Add driver ID to task spec and add driver ID to Python error handling. (#225)

* Add driver ID to task spec and add driver ID to Python error handling.

* Make constants global variables.

* Add test for error isolation.
This commit is contained in:
Robert Nishihara
2017-01-25 22:53:48 -08:00
committed by Philipp Moritz
parent 3c6686db08
commit ab8c3432f7
13 changed files with 292 additions and 108 deletions
+5 -1
View File
@@ -17,6 +17,9 @@ def random_object_id():
def random_function_id():
return photon.ObjectID(np.random.bytes(ID_SIZE))
def random_driver_id():
return photon.ObjectID(np.random.bytes(ID_SIZE))
def random_task_id():
return photon.ObjectID(np.random.bytes(ID_SIZE))
@@ -125,6 +128,7 @@ class TestTask(unittest.TestCase):
def test_create_and_serialize_task(self):
# TODO(rkn): The function ID should be a FunctionID object, not an ObjectID.
driver_id = random_driver_id()
parent_id = random_task_id()
function_id = random_function_id()
object_ids = [random_object_id() for _ in range(256)]
@@ -156,7 +160,7 @@ class TestTask(unittest.TestCase):
]
for args in args_list:
for num_return_vals in [0, 1, 2, 3, 5, 10, 100]:
task = photon.Task(function_id, args, num_return_vals, parent_id, 0)
task = photon.Task(driver_id, function_id, args, num_return_vals, parent_id, 0)
self.check_task(task, function_id, num_return_vals, args)
data = photon.task_to_string(task)
task2 = photon.task_from_string(data)