Skip to content

Can't pickle plugin sge while load balancing #165

Closed
FinchPowers opened this Issue Nov 13, 2012 · 2 comments

2 participants

@FinchPowers

Case: With the load balancer, adding a first node is fine. Adding a second one gives pickle errors.

@jtriley
Owner
jtriley commented Nov 14, 2012

@FinchPowers Good catch, thanks for reporting! However, this should be fixed within the Cluster class and not on a per-plugin basis. This is due to a recent change where the plugins kwarg is now a list of plugin objects instead of a list of dicts from the config. This helps to decouple Cluster and StarClusterConfig. Fortunately I have a simple fix for this coming.

@jtriley jtriley added a commit that closed this issue Nov 28, 2012
@jtriley cluster: fix plugin pickling bug
The recent plugins kwarg refactored the code to use a list of plugin
objects rather than plugin settings from the config. The plugin objects
were then being serialized and stored in each node's userdata when
adding nodes.

This worked, however, if the plugin stored anything that's not
serializable after its first run, such as the list of nodes, this leads
to errors when later adding nodes in the same process. The loadbalancer
in particular is affected by this bug.

Fixed this by storing the __init__ kwargs and fully qualified class path
used to create the plugin in a __plugin_metadata__ attribute which gets
dynamically created via ClusterSetup.__new__. Updated Cluster class to
serialize a list of __plugin_metadata__ attributes (stored in
Cluster._plugins) rather than the plugin object list itself (stored in
Cluster.plugins). Updated Node.get_plugins to iterate through the
__plugin_metadata__ attributes and recreate the plugin objects.

closes gh-165
1d5726c
@jtriley jtriley closed this in 1d5726c Nov 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.