AWS Thinkbox Discussion Forums

Proper way to raise an error in a Python script?

This

if not job.OutputDirectories:
        raise ValueError("Error: This job does not contain any Output Directories.")

or this

try:
        writer.WriteLine("SceneFile=%s" % plugin_scene_file) # <-doesn't exist
except Exception as e:
        print("Something went wrong when writing plugin info for Nuke.")
        print(e)

Prints the error into the report, but doesn’t seem to appear as an error in the “Errors” cell of the job, and the job itself doesn’t color red. It also keeps on going.

How can I make Deadline treat my script errors seriously and increment the Errors column as well as halt the job and color it pink?

Use FailRender(), and Deadline will fail the task and put the logs into an error report.

If you look in the application plugin code for Nuke in DeadlineRepository10\plugins\Nuke\Nuke.py you can see some examples of how it’s used.

1 Like

I see, thanks! Meanwhile I discovered the techniques from my post actually can log an error number in the column, I think I did something wrong.

I just realized that the way FailRender() is used in this example stems from Nuke plugin being a subclass of DeadlinePlugin.

Is it possible to trigger this somehow from an Event Plugin while handling a job?

Edit: Okay, actually a simple RepositoryUtils.FailJob(job) + raise ValueError seems like a solid solution in my case.

Privacy | Site terms | Cookie preferences