Submitting jub with dependency unstable.

I’m making a FumeFX sim job submission script for 3ds max.
I need to set dependencies between jobs.

Here are problems.

  1. I was using Bobo’s hack to build SMTDSettings.DependencyJobItems bitarray.
    If I try to get pnly my job with SMTDFunctions.CollectJobs useronly:true, I got undefined.
    So… I have to pull all the jobs. It takes 15 sec. Annoying.

  2. Sometimes but not always.
    SubmitMaxToDeadline_Functions.CreateSubmitInfoFile() fails because currentJobsArray is #().
    This is the error message.
    – Error occurred in i loop; filename: C:\Users\changsooeun\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\scripts\SubmitMaxToDeadline_Functions.ms; position: 179112; line: 3930
    – Frame:
    – i: 1
    – called in CreateSubmitInfoFile(); filename: C:\Users\changsooeun\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\scripts\SubmitMaxToDeadline_Functions.ms; position: 179169; line: 3932

    MAXScript Rollout Handler Exception:
    – No ““get”” function for undefined <<

If I add a code to bypass if currentJobsArray == #(), I can submit without error, but the dependencies are not set.

Any ideas?

Are you submitting multiple jobs within the same script, or do you run the script multiple times and need to figure out what the job IDs was after a submission from a day ago?

In the former case, there is usually no need to ask the Repository about your Job IDs, because you are performing the submissions, and you can fish out the JobID right after the first submission, and stuff it in the array yourself before setting the bitarray and firing the next submission. (However, it appears that the option for getting only the user’s jobs does not work right, as you mentioned. I will investigate).

You will notice that in many places in SubmitMaxToDeadline_Functions.ms, when we finish waiting for the DeadlineCommand to complete, we then call

renderMsg = SMTDFunctions.getRenderMessage() --this gets the render message SMTDFunctions.getJobIDFromMessage renderMsg --this extracts the Job ID from the message body SMTDSettings.DeadlineSubmissionLastJobID --this is the property that will now contain the Job ID

So you can call these functions after the first job submission, and this gives you the ID of the job to depend on (I assume that is the Fume sim job).
Then you can stuff the ID into a sub-array in either the SMTDSettings.JobsArray which is normally populated by the SMTDFunctions.CollectJobs() function, or into the SMTDSettings.PreviousJobsArray which is normally populated by SMTD each time a job is submitted via its UI.
If you want, you can output the IDs to a text file or INI file so you can grab them later (even the next day) when you need to submit a new job in a new session that depends on jobs from the previous day/session.

But right now I assume you want to submit a pair of jobs where the one is dependent on the other within the same script run.

I would suggest using SMTDSettings.PreviousJobsArray and setting the SMTDSettings.DependOnPreviousJobMode to #previous mode.
In other words,

SMTDSettings.DependOnPreviousJobMode = #previous --can use any or all entries from the SMTDSettings.PreviousJobsArray list SMTDSettings.DependencyJobItems = #{1} --use only the first entry --Now set the array to only the previous job's info, --the only thing that really matters is the second item, the Job ID, so we can leave the rest empty SMTDSettings.PreviousJobsArray = #(#("",SMTDSettings.DeadlineSubmissionLastJobID,"","","","","")

If you call SMTDFunctions.CreateSubmitInfoFile() after this, the code block responsible for dependencies will take the first sub-array from the SMTDSettings.PreviousJobsArray array and use its second element to set the dependency.

If you need to make your job dependent on multiple Job IDs, you can set the bitarray to multiple indices, populate the PreviousJobsArray with any number of entries with their own Job IDs you collected after submitting each of your jobs, and the next job will become dependent on all of them.

So as long as you collect the IDs after each call to SMTDFunctions.waitForCommandToComplete(), there is no need to ever ask the Repository for the Jobs, wait for 15 seconds, be annoyed and blame me for the pain :mrgreen:

Explaining a bit more about what the script is meant to do might make it clearer in my head what your problem really is…

Thanks for answer, Bobo.
To be clear, I was not blaming you :wink:.

I was submitting multiple jobs within the same script.
But, I could not use #previous, because Post sim could depend on Default or Wavelet.

I did what you suggested in my setDLdependency function like this, and now I dont need to collectJobs, yeah~!

fn setDLdependency argJobID = ( SMTDSettings.SubmitAsDependent = true SMTDSettings.DependOnPreviousJobMode = #custom SMTDSettings.DependencyJobItems = #{1} SMTDSettings.JobsArray = #(#("", argJobID,"","","","","")) )

The actual problem was DependOnPreviousJobMode.
Somehow it changed from #custom to #previous, and I did not know it has been changed.
After I forced to set #custom, everything working good.

Thanks.

Glad it worked, I was clearly joking about the blame (hence the green grinning icon) :slight_smile: