Skip to content

Commit 755d995

Browse files
authored
Feature/add buffers to detail view (#65)
Re-adds buffers / stack trace to Operation detail view.
2 parents 85370bf + 35d5381 commit 755d995

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

backend/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class Tensor(db.Model):
117117

118118
class Buffer(db.Model):
119119
__table__ = buffers
120-
120+
device= relationship("Device")
121121

122122
class InputTensor(db.Model):
123123
__table__ = input_tensors
@@ -139,6 +139,7 @@ class Operation(db.Model):
139139
inputs = db.relationship("InputTensor", lazy="joined")
140140
outputs = db.relationship("OutputTensor", lazy="joined")
141141
stack_trace = db.relationship("StackTrace")
142+
buffers = db.relationship("Buffer")
142143

143144

144145
class OperationArgument(db.Model):

backend/schemas.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class Meta:
8181
max_size_per_bank = ma.auto_field()
8282
buffer_type = ma.auto_field()
8383
device_id = ma.Function(lambda obj: obj.device.device_id)
84-
operation_id = ma.Function(lambda obj: obj.operation.operation_id)
8584

8685

8786
class OperationSchema(ma.SQLAlchemySchema):
@@ -96,7 +95,12 @@ class Meta:
9695
outputs = ma.List(ma.Nested(OutputTensorSchema()))
9796
inputs = ma.List(ma.Nested(InputTensorSchema()))
9897
arguments = ma.List(ma.Nested(OperationArgumentsSchema()))
98+
stack_trace = ma.Method("get_stack_trace")
9999

100+
def get_stack_trace(self, obj):
101+
if obj.stack_trace and len(obj.stack_trace):
102+
return next(x for x in obj.stack_trace).stack_trace
103+
return ""
100104

101105
# Filesystem Schemas
102106
class RemoteConnectionSchema(ma.Schema):

0 commit comments

Comments
 (0)