Deadline Event - OnJobSubmitted cannot modify MachineList and WhiteListFlag

Hey

Im writing a Deadline Event “OnJobSubmited” and I’m trying to modify the MachineLimitListedSlaves but it’s not working.

I’m trying with RepositoryUtils.AddSlavesToMachineLimitList() but it’s doing nothing. Same goes if I do ClientUtils.ExecuteCommandAndGetOutput(['SetJobMachineLimitListedSlaves']). But both works if I try them as JobScript right click button. It’s just in the Event OnJobSubmitted that it’s not working.

Same goes with RepositoryUtils.SetMachineLimitWhiteListFlag() for WhiteListFlag. And yes I’m doing RepositoryUtils.SaveJob() afterward.

Am I missing something?
Thanks

Would it be possible to get your event plugin code?

And just in case, the plugin is enabled under in the Monitor under Tools → Configure Events, right?

Yes it’s enabled.

Im preparing a very lighweight Event Plugin with bare minimum of code… give me around 15 min…

There you go. The plugin will be Disabled by default, so you will need to enable it to test it.

The exact same snippet of code to apply the MachineLimitList (RepositoryUtils.AddSlavesToMachineLimitList()) is working in a Job Script Right click button.
I also commented ClientUtils.ExecuteCommandAndGetOutput(['SetJobMachineLimitListedSlaves']) so you can test it out as well

Thanks

MachineLimitList.zip (1.4 KB)

I’m not going to have a chance to look into why this isn’t working today, but try SetMachineLimit() instead as it mentions creating the machinelimit for the job if it doesn’t exist already which might be the crucial difference here.

Nope SetMachineLimit() is not working in the Event Plugin. but it’s also working as a Job Script right click button…

I feel like there are 3-4 separate ways to achieve this very simple task, but none of them are working from the OnJobSubmitted callback

I took a look at your example event plugin you posted and the mistake your making is this line:

RepositoryUtils.SaveJob(job)

Your calling a job method to modify a property of the submitted job and then overwriting the job object with the old instance of the job object. Simply comment the above line out of your code and it works.

4 Likes

That was exactly it Mike!

Thanks a lot, we can close this issue