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

Create link between WrapSpawner and its child spawner traitlets #27

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion wrapspawner/wrapspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class or properties of the child Spawner at any earlier point (e.g. from
from traitlets import (
Instance, Type, Tuple, List, Dict, Integer, Unicode, Float, Any
)
from traitlets import directional_link

# Only needed for DockerProfilesSpawner
try:
Expand Down Expand Up @@ -81,7 +82,12 @@ def construct_child(self):
self.child_spawner.clear_state()
if self.child_state:
self.child_spawner.load_state(self.child_state)
self.child_spawner.api_token = self.api_token

# link traits common between self and child
common_traits = (set(self._trait_values.keys()) &
set(self.child_spawner._trait_values.keys()))
for trait in common_traits:
directional_link((self, trait), (self.child_spawner, trait))
return self.child_spawner

def load_child_class(self, state):
Expand Down