AWS Thinkbox Discussion Forums

query job repo folder from maxscript?

How could i query the job repository folder from a max job via maxscript? We need to save some additional internal logs to that folder

cheers,
laszlo

Actually, what i want specifically is the folder that the original (job) max file lives. So not the localized copy that DeadlineUtils gives me

Hey Laszlo,

This should do the trick:

	local du = DeadlineUtil
	local jobID = du.GetSubmitInfoEntry( "JobId" )
	du.LogMessage( "JOB ID = " + jobID )
	
	local jobAuxiliaryFolder = ""
	local st = timestamp()
	-- call DeadlineCommand to find the auxiliary folder for the job
	try
	(
		local result = -2
			
		local submitOutputFile = sysInfo.tempdir + "submitOutput.txt"
		local submitExitCodeFile = sysInfo.tempdir + "submitExitCode.txt"
		
		deleteFile submitOutputFile
		deleteFile submitExitCodeFile
				
		local commandArguments = "-outputfiles \"" + submitOutputFile + "\" \"" + submitExitCodeFile + "\" -GetJobAuxiliaryPath \"" + jobID + "\""
		local deadlineCommandBG = systemTools.getEnvVariable( "DEADLINE_PATH" ) + "\\deadlinecommandbg.exe"
		ShellLaunch deadlineCommandBG commandArguments
				
		local startTimeStamp = timestamp()
		local ready = false
		while not ready do
		(
			sleep 0.15
			if doesFileExist submitExitCodeFile do
			(
				local theFile = openFile submitExitCodeFile
				try(result = readValue theFile)catch(result = -2)
				try(close theFile)catch()
				ready = true
			)	
			if timestamp() - startTimeStamp > 10000 then 
			(
				result = -3
				ready = true
			)	
		)
		
		if( result == 0 ) then
		(
			local resultFile = OpenFile submitOutputFile
			local resultMsg = ""
			if (resultFile != undefined) do
			(
				try(resultMsg = readLine resultFile)catch()
				try(close resultFile)catch()
			)
			
			jobAuxiliaryFolder = resultMsg
			du.LogMessage( "JOB AUXILIARY FOLDER: " + jobAuxiliaryFolder )
		)
		else
		(
			if result == -3 then
				du.WarnMessage( "Timed out getting job auxiliary folder from Deadline Command." )
			else
				du.WarnMessage( "Failed to get job auxiliary folder from Deadline Command." )
		)
	)
	catch
		du.WarnMessage( "Error calling Deadline Command to get job auxiliary folder." )

Cheers,

  • Ryan

DeadlineUtil has the function: GetAuxFilename( int index ). However, I couldn’t get this to work…

DeadlineUtil.GetAuxFilename( 0 )

…should return the first Aux file with a job. As the job info file is now in the DB, then the first Aux file (0-index based), will always be the Max file. If it’s been submitted with the job, then the path will be stripped and you can assume it’s in the defined Aux repo path (default or custom path) OR if it’s been referenced from a file server, then the full file path will be returned by this function?

…Surely it can’t be that simple? (I must be missing something here, but I ask, as I would like to know the answer as well!) :slight_smile:

EDIT: Oh hold on a second…it’s “GetAuxFilename”…perhaps it only return’s the Max Filename and NOT it’s entire file path & filename?

If the scene file is submitted with the job, then this function will return the full LOCAL path to the scene file after it is copied to the slave. If it’s not submitted with the job, then it’s not considered an auxiliary file.

So a couple questions:

  1. Are you submitting the scene file with the job?
  2. If the answer to (1) is yes, what is the function returning for you?

Cheers,

  • Ryan
  1. Yes, Max file submitted to jobs dir on repo
  2. I insert this (bottom line only) line into the customise.ms file in 3dsmax plugin dir:

[code]DeadlineUtil.LogMessage “Applying customizations to max file…”

DeadlineUtil.LogMessage (">Adding scene path ‘" + DeadlineUtil.SceneFilePath + "’ to session paths")
sessionPaths.add #map DeadlineUtil.SceneFilePath

DeadlineUtil.LogMessage (">Aux File ‘" + DeadlineUtil.GetAuxFilename(0) + "’ found")[/code]

and I get this error:

Slave log:

2013-10-02 18:08:08: 0: INFO: Connected to 3dsmax plugin version Lightning 6.1.0.52823 Sep 25 2013 09:47:02 R 2013-10-02 18:08:08: 0: INFO: Scene file to render: "C:\Users\owenm\AppData\Local\Thinkbox\Deadline6\slave\WIN7X64\jobsData\5245d85b71bd0c0c24a10070\DraftTileRenderingTest_MultiRegions_SingleFrame.max" 2013-10-02 18:08:08: 0: INFO: Camera: "mike_cam" 2013-10-02 18:08:08: 0: INFO: Restarting renderer after each frame: 1 2013-10-02 18:08:08: 0: INFO: Showing frame buffer: 1 2013-10-02 18:08:08: 0: INFO: Overriding save file option: True 2013-10-02 18:08:08: 0: INFO: Frame number base: 0 2013-10-02 18:08:08: 0: INFO: Remove padding from output filename: 0 2013-10-02 18:08:08: 0: INFO: Ignore missing external file errors: 1 2013-10-02 18:08:08: 0: INFO: Ignore missing UVW errors: 1 2013-10-02 18:08:08: 0: INFO: Ignore missing XREF errors: 1 2013-10-02 18:08:08: 0: INFO: Ignore missing DLL errors: 0 2013-10-02 18:08:08: 0: INFO: Disabling Multipass: 0 2013-10-02 18:08:08: 0: INFO: Region rendering enabled: left = 0, top = 0, right = 0, bottom = 0, padding = 0, type = CROP 2013-10-02 18:08:08: 0: INFO: Loading 3dsmax scene file 2013-10-02 18:08:08: 0: INFO: Scene loaded successfully 2013-10-02 18:08:08: 0: INFO: Executing script: C:\Users\owenm\AppData\Local\Thinkbox\Deadline6\slave\WIN7X64\plugins\5245d85b71bd0c0c24a10070\customize.ms 2013-10-02 18:08:08: 0: INFO: Applying customizations to max file... 2013-10-02 18:08:08: 0: INFO: >Adding scene path 'C:\Users\owenm\AppData\Local\Thinkbox\Deadline6\slave\WIN7X64\jobsData\5245d85b71bd0c0c24a10070' to session paths 2013-10-02 18:08:09: 0: An exception occurred: Error in StartJob: RenderTask: Unexpected exception (Exception caught in 3ds max: -- Unable to convert: undefined to type: String 2013-10-02 18:08:09: 2013/10/02 18:08:08 DBG: [03196] [01252] Interface8::LoadFromFile(C:/Users/owenm/AppData/Local/Thinkbox/Deadline6/slave/WIN7X64/jobsData/5245d85b71bd0c0c24a10070/DraftTileRenderingTest_MultiRegions_SingleFrame.max) 2013-10-02 18:08:09: 2013/10/02 18:08:08 INF: [03196] [01252] Starting to load file: C:/Users/owenm/AppData/Local/Thinkbox/Deadline6/slave/WIN7X64/jobsData/5245d85b71bd0c0c24a10070/DraftTileRenderingTest_MultiRegions_SingleFrame.max 2013-10-02 18:08:09: 2013/10/02 18:08:08 INF: [03196] [01252] Done loading file: C:/Users/owenm/AppData/Local/Thinkbox/Deadline6/slave/WIN7X64/jobsData/5245d85b71bd0c0c24a10070/DraftTileRenderingTest_MultiRegions_SingleFrame.max 2013-10-02 18:08:09: 2013/10/02 18:08:08 INF: [03196] [01252] SYSTEM: Production renderer is changed to V-Ray Adv 2.40.04. Previous messages are cleared. 2013-10-02 18:08:09: ) 2013-10-02 18:08:09: at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel) (Deadline.Plugins.RenderPluginException)

Thanks! We figured out what the problem was, and this will be fixed in beta 7.

Cheers,

  • Ryan
Privacy | Site terms | Cookie preferences