Question on plugin API

Hi guys, I have a few curiosity questions about the new Plugin API

The example to setup the callbacks in the plugin init method is using a += operator to set the callback method. ( self.InitializeProcessCallback += self.InitializeProcess)

I am only familiar with this += for integer and I never saw it in python used in this fashion.
Is this an IronPython thing?
Could you explain how it works.

When I try to recreate this in a simple pure python class example is always fails.

  1. I see the CleanupDeadlinePlugin() function in most factory plugins.
    When is this method called? At the end of a task?

Thanks

To be clear, the new plugin API uses Python for .NET, it is not IronPython anymore (hence the need for changes). But yeah, using the ‘+=’ operator to connect Event Handlers to Events is a .NET construct, and Python for .NET adds an implementation to allow this to work from Python when working with .NET events.

This function gets called whenever the plugin is unloaded. Typically, this would be once a Slave is done with a particular Job, but if you have “Reload Plugin Between Tasks” turned on for a Job it should get also called between Tasks. The idea behind this function is to cleanup anything that might prevent the memory used for the Plugin from being reclaimed – mainly Event Handlers. So any .NET Event Handlers you set up on initialization, you should clean up here so that the Plugin can be garbage collected properly.

Thanks for the very helpful information.