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

HasEnvironment prepare method #642

Closed
dleibrandt opened this issue Dec 15, 2016 · 2 comments
Closed

HasEnvironment prepare method #642

dleibrandt opened this issue Dec 15, 2016 · 2 comments

Comments

@dleibrandt
Copy link
Contributor

This is a followup to #545. I'm trying to do similar things to @r-srinivas, but most of my subcomponents inherit from HasEnvironment and not EnvExperiment (since the subcomponents don't have run methods). I'd like HasEnvironment to have the same prepare method as EnvExperiment, where it calls the prepare method of its children. Would it be possible to implement this?

@sbourdeauducq
Copy link
Member

HasEnvironment just provides access to the dataset, devices, etc. without the prepare/run/analyze structure that comes with Experiment and relates to the pipeline stages of the scheduler. So not in ARTIQ. But you can implement it yourself by copy-pasting this small bit of ARTIQ code where you define prepare (self.children is provided by HasEnvironment):

    def prepare(self):
        for child in self.children:
            if hasattr(child, "prepare"):
                child.prepare()

Might be a good idea to call your prepare something else if it doesn't relate to the preparation stage of the scheduler pipeline.

@sbourdeauducq
Copy link
Member

829885d#commitcomment-35229255
see call_children_method

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

No branches or pull requests

2 participants