Skip to content

Commit

Permalink
Fix str of RayTaskError (#5878)
Browse files Browse the repository at this point in the history
* fix key error

* fix
  • Loading branch information
ericl authored Oct 10, 2019
1 parent 1100556 commit c3b2ae2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions python/ray/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def __init__(self,
function_name,
traceback_str,
cause_cls,
proctitle=None,
pid=None,
ip=None):
"""Initialize a RayTaskError."""
if setproctitle:
if proctitle:
self.proctitle = proctitle
elif setproctitle:
self.proctitle = setproctitle.getproctitle()
else:
self.proctitle = "ray_worker"
Expand All @@ -58,24 +61,22 @@ def as_instanceof_cause(self):
if issubclass(RayTaskError, self.cause_cls):
return self # already satisfied

class cls(self.cause_cls, RayTaskError):
def __init__(self, function_name, traceback_str, cause_cls, pid,
host):
class cls(RayTaskError, self.cause_cls):
def __init__(self, function_name, traceback_str, cause_cls,
proctitle, pid, ip):
RayTaskError.__init__(self, function_name, traceback_str,
cause_cls, pid, host)
cause_cls, proctitle, pid, ip)

name = "RayTaskError({})".format(self.cause_cls.__name__)
cls.__name__ = name
cls.__qualname__ = name

return cls(self.function_name, self.traceback_str, self.cause_cls,
self.pid, self.ip)
cls.original = self
return cls
self.proctitle, self.pid, self.ip)

def __str__(self):
"""Format a RayTaskError as a string."""
lines = self.traceback_str.split("\n")
lines = self.traceback_str.strip().split("\n")
out = []
in_worker = False
for line in lines:
Expand Down

0 comments on commit c3b2ae2

Please sign in to comment.