Pulling output path from job


#1

Hi,

I’m sorting out a plugin to kick off a draft job once another job has finished. At this point, the tile assembly job completes, the event plugin see this and then creates a draft job.

Only problem being that I can’t seem to get it to create an output for the draft job.

[code]# Create job info file.
jobInfoFilename = Path.Combine( ClientUtils.GetDeadlineTempPath(), “draftResizer.job” )
writer = StreamWriter( jobInfoFilename, False, Encoding.Unicode )
writer.WriteLine( “Plugin=DraftPlugin” )
writer.WriteLine( “Name=%s” % job.JobName )
writer.WriteLine( “Comment=Autodraft Test” )
writer.WriteLine( “Group=tile-assembly” )
writer.WriteLine( “Priority=100” )
writer.WriteLine( “Frames=%s” % job.JobFrames )
#writer.WriteLine( “JobDependencies=%s” % job.JobDependencies )
# writer.WriteLine( “OutputDirectory0=%s” % job.JobOutputDirectories )
writer.WriteLine( “BatchName=DraftJobs” )
#writer.WriteLine( “BatchName=DraftJobs” % job.JobName )

    writer.Close()

Create plugin info file.

    pluginInfoFilename = Path.Combine( ClientUtils.GetDeadlineTempPath(), "draftResizer_info.job" )
    writer = StreamWriter( pluginInfoFilename, False, Encoding.Unicode )

    # writer.WriteLine( "SceneFile=%s" % sceneFile )
            
    writer.WriteLine( 'ScriptArg0=resolution="1"' )
    writer.WriteLine( 'ScriptArg1=codec="jpeg"' )
    writer.WriteLine( 'ScriptArg10=quickType="createImages"' )
    writer.WriteLine( 'ScriptArg11=isDistributed="False"' )
    writer.WriteLine( 'ScriptArg12=frameList="0"' )
    writer.WriteLine( 'ScriptArg13=SubmitQuickDraft="True"' )
    writer.WriteLine( 'ScriptArg2=colorSpaceIn="Identity"' )
    writer.WriteLine( 'ScriptArg3=colorSpaceOut="Identity"' )
    writer.WriteLine( 'ScriptArg4=DraftExtension="jpg' )
    writer.WriteLine( 'ScriptArg5=annotationsImageString="None"' )
    writer.WriteLine( 'ScriptArg6=annotationsResWidthString="None"' )
    writer.WriteLine( 'ScriptArg7=annotationsResWidthString="None"' )
    writer.WriteLine( 'ScriptArg8=annotationsFramePaddingSize="None"' )
    writer.WriteLine( 'ScriptArg9=quality="85"' )
    writer.WriteLine( 'ScriptFile=\\\p\DeadlineRepository9\events\DraftEventPlugin\DraftQuickSubmission\QuickDraft.py' )

    writer.WriteLine( "OutputDirectory=%s" % job.JobOutputDirectories )
    writer.WriteLine( "OutputFilename=%s" % job.JobOutputFileNames )
    writer.Close()

[/code]

The job.JobName and job.JobFrames are pulling through the correct information from the previous job, but the job.OutputDirectories/job.JobOutputFilenames are just bringing up an error in the console:

2017-08-18 12:21:14: JobID=5996cdaa2b1a722e8c26a5a3 2017-08-18 12:21:14: The job was submitted successfully, but there were some warnings: 2017-08-18 12:21:14: - Key-value pair not supported: "OutputDirectory=System.String[]" 2017-08-18 12:21:14: INFO: On Job Submitted Event Plugin: Override Job Name Started

It’s probably something simple, but I’ve tried a number of variations but still end up with no output and a failed job.

Any pointer are appreciated.

Thanks!


Deadile Quict Draft Automate for nuke
#2

Well, there are a few issues.

The first one is that you’re using a C# string array (hence the System.String[]). The second part is that Draft’s output files are specified differently than the job info’s version of that (one’s for Draft’s benefit, one’s for the Monitor’s “explore output” feature).

To fix that you would so something like so:

            draft_output_files = list(job.JobOutputFileNames) # Make it Python list instead of C# array
            if len(draft_output_files) > 0:
                scriptArgs.append( 'outFile="%s" ' % draft_output_files[0] )
                scriptArgs.append( 'outFolder="%s" ' % Path.GetDirectoryName( draft_output_files[0] ) )
            else:
                print("Couldn't find output filenames from job {0}".format(job.JobId))