Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre/Post Transform/Apply Observer #106

Open
dboyliao opened this issue Mar 20, 2020 · 2 comments
Open

Pre/Post Transform/Apply Observer #106

dboyliao opened this issue Mar 20, 2020 · 2 comments
Assignees

Comments

@dboyliao
Copy link
Member

dboyliao commented Mar 20, 2020

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.

@dboyliao dboyliao self-assigned this Mar 20, 2020
@dboyliao
Copy link
Member Author

@mbartling

@dboyliao dboyliao mentioned this issue Mar 20, 2020
@mbartling
Copy link
Member

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants