AWS Thinkbox Discussion Forums

Can't find solution to this Deadline Scripting Error

Hi all,
I am scripting a script that automatically VRAY denoises rendered frames. This works great. But I do get this error after the denoise job finishes:

[code]=======================================================
Error

Event Error (OnJobFinished): IndexError : array index out of range

=======================================================
Type

PythonException

=======================================================
Stack Trace

File “none”, line 55, in OnJobFinished

=======================================================
Log

2018-01-25 16:01:48: An error occurred in the “OnJobFinished” function in events plugin ‘automVRAYDenoise’: IndexError : array index out of range (Python.Runtime.PythonException)
2018-01-25 16:01:48: File “none”, line 55, in OnJobFinished
2018-01-25 16:01:48: (Deadline.Events.DeadlineEventPluginException)
2018-01-25 16:01:48: bei Deadline.Events.DeadlineEventPlugin.(String , Exception )
2018-01-25 16:01:48: bei Deadline.Events.DeadlineEventPlugin.OnJobFinished(Job job)
2018-01-25 16:01:48: bei Deadline.Events.DeadlineEventManager.OnJobsFinished(Job[] jobs, DataController dataController)
2018-01-25 16:01:48: ---------- Inner Stack Trace (Python.Runtime.PythonException) ----------
2018-01-25 16:01:48: File “none”, line 55, in OnJobFinished

=======================================================
Details

Date: 01/25/2018 16:01:48
Event Type: OnJobFinished
Job Submit Date: 01/25/2018 15:35:03
Job User: alex
[/code]

This is the script (mostly commented)

[code]from Deadline.Events import *

import os
import re

from System import *
from System.Collections.Specialized import *
from System.IO import *
from System.Text import *

from Deadline.Scripting import *

######################################################################

This is the function that Deadline calls to get an instance of the

main DeadlineEventListener class.

######################################################################
def GetDeadlineEventListener():
return automaticVRAYDenoise()

######################################################################

This is the function that Deadline calls when the event plugin is

no longer in use so that it can get cleaned up.

######################################################################
def CleanupDeadlineEventListener( deadlinePlugin ):
deadlinePlugin.Cleanup()

######################################################################

This is the main DeadlineEventListener class for MyEvent.

######################################################################
class automaticVRAYDenoise (DeadlineEventListener):

def __init__(self):
    self.OnJobFinishedCallback += self.OnJobFinished

def Cleanup(self):
    del self.OnJobFinishedCallback
	
def OnJobFinished( self, job ):
    # TODO: Connect to pipeline site to notify it that the job for a particular
    # shot or task is complete.
    if job.JobPlugin != "Cinema4DBatch":
		return
    jobInfoFilename = Path.Combine( ClientUtils.GetDeadlineTempPath(), "automVRAYDenoise_jobInfo.job" )
    writer = StreamWriter( jobInfoFilename, False, Encoding.Unicode )
    writer.WriteLine( "Plugin=VDenoise" )
    writer.WriteLine( "Name=%s - Automatic VRAY Denoise" % job.JobName )
    
    
    outputDirectory = job.OutputDirectories[0]
    outputFilename = job.OutputFileNames[0]
    outputFilename = outputFilename.replace("#","")
    outputFilename = outputFilename[:-4]
    #self.LogInfo( "trace Name=%s" % job.OutputDirectories[0] )
    #self.LogInfo( "trace Name=%s" % job.OutputFileNames[0] )
    vrayDenoisePath = "%s\%s.????.vrimg" % (outputDirectory,outputFilename)
    self.LogInfo( vrayDenoisePath )
    
	
    writer.WriteLine( "Frames=%s" % job.JobFrames )
    #writer.WriteLine( "Comment=%s" % scriptDialog.GetValue( "CommentBox" ) )
    #writer.WriteLine( "Department=%s" % scriptDialog.GetValue( "DepartmentBox" ) )
    #writer.WriteLine( "Pool=%s" % scriptDialog.GetValue( "PoolBox" ) )
    #writer.WriteLine( "SecondaryPool=%s" % scriptDialog.GetValue( "SecondaryPoolBox" ) )
    #writer.WriteLine( "Group=%s" % scriptDialog.GetValue( "GroupBox" ) )
    #writer.WriteLine( "Priority=%s" % scriptDialog.GetValue( "PriorityBox" ) )
    #writer.WriteLine( "TaskTimeoutMinutes=%s" % scriptDialog.GetValue( "TaskTimeoutBox" ) )
    #writer.WriteLine( "EnableAutoTimeout=%s" % scriptDialog.GetValue( "AutoTimeoutBox" ) )
    #writer.WriteLine( "ConcurrentTasks=%s" % scriptDialog.GetValue( "ConcurrentTasksBox" ) )
    #writer.WriteLine( "LimitConcurrentTasksToNumberOfCpus=%s" % scriptDialog.GetValue( "LimitConcurrentTasksBox" ) )
    
    #writer.WriteLine( "MachineLimit=%s" % scriptDialog.GetValue( "MachineLimitBox" ) )
    #if( bool(scriptDialog.GetValue( "IsBlacklistBox" ) ) ):
    #    writer.WriteLine( "Blacklist=%s" % scriptDialog.GetValue( "MachineListBox" ) )
    #else:
    #    writer.WriteLine( "Whitelist=%s" % scriptDialog.GetValue( "MachineListBox" ) )
    
    #writer.WriteLine( "LimitGroups=%s" % scriptDialog.GetValue( "LimitGroupBox" ) )
    #writer.WriteLine( "JobDependencies=%s" % scriptDialog.GetValue( "DependencyBox" ) )
    #writer.WriteLine( "OnJobComplete=%s" % scriptDialog.GetValue( "OnJobCompleteBox" ) )
    
    #if( bool( scriptDialog.GetValue( "SubmitSuspendedBox" ) ) ):
    #    writer.WriteLine( "InitialStatus=Suspended" )

    #if bool( scriptDialog.GetValue( "UseFramesCheck" ) ):
    #    frames = scriptDialog.GetValue( "FramesBox" )
    #    chunkSize = scriptDialog.GetValue( "ChunkSizeBox" )
    #else:
    #    frames = 1
    #    chunkSize = 1

    #writer.WriteLine( "Frames=%s" % frames )
    #writer.WriteLine( "ChunkSize=%s" % chunkSize )

    writer.Close()
    
    # Create plugin info file.
    pluginInfoFilename = Path.Combine( ClientUtils.GetDeadlineTempPath(), "automVRAYDenoise_pluginInfo.job" )
    writer = StreamWriter( pluginInfoFilename, False, Encoding.Unicode )

    writer.WriteLine( "InputPath=%s" % vrayDenoisePath )        
    writer.WriteLine( "DenoiseMode=Default" )
    #writer.WriteLine( "Boost=%s" % scriptDialog.GetValue("BoostBox" ) )
    writer.WriteLine( "SkipExisting=True" )
    writer.WriteLine( "DenoiseElements=False" )
    writer.WriteLine( "UseGPU=True" )
    #writer.WriteLine( "OverrideThreshold=%s" % scriptDialog.GetValue("OverrideThresholdCheck" ) )
    #writer.WriteLine( "Threshold=%s" % scriptDialog.GetValue("ThresholdBox" ) )
    #writer.WriteLine( "OverrideStrength=%s" % scriptDialog.GetValue("OverrideStrengthCheck" ) )
    #writer.WriteLine( "Strength=%s" % scriptDialog.GetValue("StrengthBox" ) )
    #writer.WriteLine( "OverrideRadius=%s" % scriptDialog.GetValue("OverrideRadiusCheck" ) )
    #writer.WriteLine( "PixelRadius=%s" % scriptDialog.GetValue("RadiusBox" ) )
    #writer.WriteLine( "AdjustRadius=%s" % scriptDialog.GetValue("AutoRadiusCheck" ) )
    #writer.WriteLine( "FrameBlend=%s" % scriptDialog.GetValue("BlendBox" ) )
    #writer.WriteLine( "RenderStrips=%s" % scriptDialog.GetValue("StripsBox" ) )
    #writer.WriteLine( "UsingFrames=%s" % scriptDialog.GetValue( "UseFramesCheck" ) )
    
    writer.Close()

    ClientUtils.ExecuteCommand( (jobInfoFilename,pluginInfoFilename) )


    self.LogInfo("Event Plugin: Complete")[/code]

Any ideas?

Hey blenderme,

I think you were on the right track with testing your output directories/filenames.

Not sure which Deadline version you’re on, but looking at the scripting docs for Deadline 10, the accessor is different than the one you’re trying. ‘JobOutputDirectories’ vs ‘OutputDirectories’.

outputDirectories = job.JobOutputDirectories
outputFilenames = job.JobOutputFileNames

# And then something like this
for outputDir in outputDirectories:
    self.LogInfo(outputDir)
    
# or what you were trying
self.LogInfo( outputDirectories[0] )

You should then be able to iterate over those or access the 0th index (if the job has those values set). Let me know if this solves your issue.

Cheers

Thank you so much, that actually did the trick!

I do have a followup:

When the submitter plugin in c4d is loaded, some fields such as “frames” are already populatet from the scene file. Now I am not quite sure, how the plugin gets this info, the submitter plugin is only a few lines of code and i can’t see anything being passed on.

Is it possible to get other info out of the scene, such as specific render settings from vray?

Thanks!!

Glad to hear it’s working!

It sounds like you’re looking at our client file (DeadlineC4DClient.py) for C4D. Our submitters usually consist of a client file and a main file. The client file’s sole purpose is to be installed in an application so it can call the main script (DeadlineRepository10/submission/Cinema4D/Main/SubmitC4DToDeadline.py) that is easily be updated without running the installers each new minor/build version.

You can potentially get more information out of the scene by the modifying the script or running a custom sanity check but it’s more about what C4D/V-Ray give access to and what kind of information you’re looking for. Hope this helps.

Cheers

Privacy | Site terms | Cookie preferences