Skip to content

Commit

Permalink
Create link between WrapSpawner and its child spawner traitlets (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-ntrf authored and mbmilligan committed Jun 18, 2019
1 parent 5f2b707 commit 2d45cb9
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 2d45cb9

Please sign in to comment.