Skip to content

Commit

Permalink
Feature/add buffers to detail view (#65)
Browse files Browse the repository at this point in the history
Re-adds buffers / stack trace to Operation detail view.
  • Loading branch information
GregHattJr authored Aug 15, 2024
2 parents 85370bf + 35d5381 commit 755d995
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Tensor(db.Model):

class Buffer(db.Model):
__table__ = buffers

device= relationship("Device")

class InputTensor(db.Model):
__table__ = input_tensors
Expand All @@ -139,6 +139,7 @@ class Operation(db.Model):
inputs = db.relationship("InputTensor", lazy="joined")
outputs = db.relationship("OutputTensor", lazy="joined")
stack_trace = db.relationship("StackTrace")
buffers = db.relationship("Buffer")


class OperationArgument(db.Model):
Expand Down
6 changes: 5 additions & 1 deletion backend/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class Meta:
max_size_per_bank = ma.auto_field()
buffer_type = ma.auto_field()
device_id = ma.Function(lambda obj: obj.device.device_id)
operation_id = ma.Function(lambda obj: obj.operation.operation_id)


class OperationSchema(ma.SQLAlchemySchema):
Expand All @@ -96,7 +95,12 @@ class Meta:
outputs = ma.List(ma.Nested(OutputTensorSchema()))
inputs = ma.List(ma.Nested(InputTensorSchema()))
arguments = ma.List(ma.Nested(OperationArgumentsSchema()))
stack_trace = ma.Method("get_stack_trace")

def get_stack_trace(self, obj):
if obj.stack_trace and len(obj.stack_trace):
return next(x for x in obj.stack_trace).stack_trace
return ""

# Filesystem Schemas
class RemoteConnectionSchema(ma.Schema):
Expand Down

0 comments on commit 755d995

Please sign in to comment.