Skip to content

Pre/Post Transform/Apply Observer #106

@dboyliao

Description

@dboyliao

Implement an interface for users to register pre/post transformation/apply observers for BackendPart and Transformer.

@classmethod
def regiseter_prior_observer(cls, callback):
    cls.prior_observer.append(callback)

@classmethod
def register_post_observer(cls, callback):
    # similar code

def apply(self, ugraph):
    for callback in type(self).prior_observer:
        callback(ugraph)
    # do work with ugraph
    for callback in type(self).prior_observer:
        callback(ugraph)

Unify the interface for users to inspect the graph, such as inject pdb break point in the callback.
Note that these observers should not introduce side-effect to the graph.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions