Skip to content

Add custom pyblish test to fail even after validation during extraction or integration if anything errors. #244

@BigRoy

Description

@BigRoy

Issue

Currently whenever one Extractor fails with an error the remaining Extractors will still start processing, even though Integration will still be skipped since it's checking explicitly inside the Integrator whether that have been any errors, and if so... it disallows the integration into the pipeline.

The problem with this is that the first Extractor could fail and even other long running Extractors will still try to continue, even though we know it will be useless anyway.

Solution

We can override Pyblish's behavior which only stop after validation if any errors occurred to our own test that stops in our other cases too.

For example:

import pyblish.logic
import pyblish.api

def custom_test(**vars):

    # Keep default behavior
    default_result = pyblish.logic.default_test(**vars)
    if default_result:
        return default_result

    # Add custom behavior
    # Fail on anything after validation having an error.
    after_validation = pyblish.api.ValidatorOrder + 0.5
    if any(order >= after_validation for order 
           in vars["ordersWithErrors"]):
        return "failed after validation"


pyblish.api.register_test(custom_test)

Note this would have the downside that also Cleanup would not get triggered, as such the local disk (staging dir) might get a filled up temporary folder. This could be an additional problem that might need to be taken care of...

Another workaround could be to have our Extractors also initially check whether any errors have occurred, and if so... to raise an Error themselves, yet have the Cleanup plug-in always run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions