wickman / pesos

pesos is a pure python implementation of the mesos framework api
47 stars 11 forks source link

AttributeError in SchedulerProcess._local_lost #24

Open anthonyrisinger opened 9 years ago

anthonyrisinger commented 9 years ago
Traceback (most recent call last):
  File "/lib/python2.7/site-packages/tornado/ioloop.py", line 568, in _run_callback
    ret = callback()
  File "/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/lib/python2.7/site-packages/pesos/scheduler.py", line 304, in launch_tasks
    self._local_lost(task, 'Malformed: A task must have either an executor or command')
  File "/lib/python2.7/site-packages/pesos/scheduler.py", line 279, in _local_lost
    update = mesos_pb2.StatusUpdate(
AttributeError: 'module' object has no attribute 'StatusUpdate'

partial fix...?

diff --git a/pesos/scheduler.py b/pesos/scheduler.py
index 9a0eba1..c7b184a 100644
--- a/pesos/scheduler.py
+++ b/pesos/scheduler.py
@@ -6,6 +6,7 @@ import threading
 import time
 import socket
 import sys
+import uuid

 from .detector import MasterDetector
 from .util import camel_call, timed, unique_suffix
@@ -276,14 +277,14 @@ class SchedulerProcess(ProtobufProcess):
     self.send(self.master, message)

   def _local_lost(self, task, reason):
-    update = mesos_pb2.StatusUpdate(
+    update = internal.StatusUpdate(
         framework_id=self.framework.id,
-        status=mesos.TaskStatus(
-            task_id=task.id,
-            state=mesos.TASK_LOST,
+        timestamp=self.clock.time(),
+        uuid=uuid.uuid4().get_bytes(),
+        status=mesos_pb2.TaskStatus(
+            task_id=task.task_id,
+            state=mesos_pb2.TASK_LOST,
             message=reason,
-            timestamp=now,
-            uuid=uuid.uuid4().get_bytes(),
         )
     )
     self.send(self.pid, update)

no pull req because i haven't tested much (really at all) and i'm short on time; just wanted to document something the popped up in my travels.

tarnfeld commented 9 years ago

Sounds like a sane diff :+1: