def activate(self, user): # TODO store a link between component and session # (here linking session and image required by session) session = Session.get_or_launch( user=user, image_name=self.image() ) # Start the session (may already be) and then wait until ready (may already be) session.start() session.wait() # Request the component to be restored into the session session.request( verb='PUT', resource=self.address.id, method='restore' ) return session