Hi,
I am working on a script that does need to explicitely fail whole job on a particular failure.
Not only has it to fail a task but whole job in general to prevent any futher tasks from being executed
again and again. How should this be done ?
Deadline is running 3dsmax in full gui mode and executing some maxscript.
Maxscript does use blur python extensions in order to execute some python code.
thank you
You can use the FailJob subcommand of DeadlineCommand:
DeadlineCommand.exe FailJob [Job ID(s)]
You can also fail a job through the scripting API. See the FailJob(Job job) function in the Deadline.Scripting.RepositoryUtils class.
Hi,
How can I get jobId from within the script executed inside of 3dsmax which is controlled by deadline ?
Deadline uses a unique c++ maxscript extension plugin called: “Lightning” within the 3dsmax plugin. This has an exposed Maxscript Interface:
docs.thinkboxsoftware.com/produc … -interface
However, this interface doesn’t currently expose the ability to query a current job’s Deadline property such as JobId, only the JobInfo and PlugInfo KVP’s. This is probably a good feature request for the Lightning plugin.
[s]Here’s a quick hack which should work for now. The returned “JobsDataFolder” already contains the Job Id as a string, so you could just filter it out to grab the Job Id.
DeadlineUtil.JobsDataFolder
[/s]
EDIT:
It turns out answering forum threads before at least one strong coffee of a morning is not such a great idea. All job properties can already be queried via the MaxScript function:\
DeadlineUtil.GetSubmitInfoEntry
So, in the case of Job ID it would be:
DeadlineUtil.GetSubmitInfoEntry "JobId"
For other job properties that you might be interested in, they are all listed here:
docs.thinkboxsoftware.com/produc … properties
Thank you for reply. This is great !
Having this Id, how do I call FailJob ?
The SMTD based maxscript files have good examples of how a process can be spawned via MaxScript.
[code] fn CallDeadlineCommand command =
(
local resultMsg = “”
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 + "\" " + command
local BinDir = systemTools.getEnvVariable( "DEADLINE_PATH" ) + "\\"
local deadlineCommandBG = BinDir + "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
if (resultFile != undefined) do
(
try(resultMsg = readLine resultFile)catch()
try(close resultFile)catch()
)
)
) catch ()
resultMsg
)[/code]
jobId = DeadlineUtil.GetSubmitInfoEntry "JobId"
result = CallDeadlineCommand ("-FailJob " + jobId)
print result
The above is untested, but should get you close.