[solved] InstancePlugin not running as Collector?


#1

Problem

I’m using Pyblish 1.31 and somehow my Collectors weren’t processing correctly when they required to run on an instance. It didn’t matter whether they operated on a family or not.

For example:

import pyblish.api


@pyblish.api.log
class CollectNotRunning(pyblish.api.InstancePlugin):
    order = pyblish.api.CollectorOrder

    def process(self, instance):
        return

This shows up in the GUI but upon validating or publish it stays white and doesn’t get run. It seems that anything processing an instance (an InstancePlugin) before Validators is ignored.

For example, this actually runs:

import pyblish.api


@pyblish.api.log
class CollectNotRunning(pyblish.api.InstancePlugin):
    order = pyblish.api.ValidatorOrder - 0.499

    def process(self, instance):
        return

But it shows up under the Validators and doesn’t get run during collection.

Expected

I would expect to be able to do:

import pyblish.api


@pyblish.api.log
class CollectNotRunning(pyblish.api.InstancePlugin):
    order = pyblish.api.CollectorOrder + 0.1
    families = ['rig']

    def process(self, instance):
        return

Where this one gets run on instances of the rig family during the Collection. So only gets run when the family is present. Even with an instance of rig present this is still not running.


#2

Think this is the same issue as; https://github.com/pyblish/pyblish-base/issues/243


#3

Yes, seems to be the same issue. But the reason it’s closed seems to be wrong… will link this post there. Since now it’s actually not running even though another Collector actually collected an Instance beforehand, even whether or not it should filter through family.

I think the logic described here still makes sense to me and currently isn’t working as expected.


#4

This is definitely a bug.

It’s due to the recent performance enhancements of 1.3. Previously, after each process had taken place, the Context was re-fetched from the host. This caused a performance bottleneck, because most of the time, the Context would not change (think Validators, and Extractors etc.). It would only be visible, and a problem, during collection.

In this case, the instance created in a prior collector wasn’t made visible until after Collection had completed, and so the Collector above, that operates solely on Instances, was never run.

I found the cause of this and will push a fix in a bit.


#5

Great, thanks!

Will this slow it back down much again? This release feels really smooth and I’m loving the speed of it. :wink: Wonder what the fix will be.

Anyway, thanks a lot for taking a look this quickly.


Pyblish 1.3 Released
#6

Haha, unfortunately yes. But it won’t affect the GUI, only the total time it takes to process. Before, this loading time was freezing the GUI, which is probably the difference you are experiencing now, and that remains. :slight_smile:

Edit: Sorry, I meant the GUI will still feel silky smooth with this fix!


#7

@marcus does this also fix this?


#8

Haven’t had a chance to look at that yet.


#9

Fixed

Seems to be fixed in latest pyblish-win. Somehow the GUI itself still says 1.3.1 but I believe it’s 1.3.2, as also noted here.

Of course it’s recommended to give it an order that runs just after the collectors that add the instances, e.g CollectorOrder + 0.1 so you can ensure the instances were already created. Otherwise the InstancePlugin might run before the other plug-ins if they have the same order, and as such the instance didn’t exist at the time.

Sweet!


ContextPlugin running when instance of family not present