AWS Thinkbox Discussion Forums

Clear Bad Slaves in Python

Hey,

Just wondering if there was a way to reset slaves that have been marked as bad using the python api of Deadline 6.2? (The built in, not standalone).

I have explored and was unable to find it using the documentation.

Thanks for any help :slight_smile:

Well, this is of the properties we don’t have documented. We’re going to make a wrapper for this, so be aware that doing this now might lead to issues down the road if we change it.

There’s a list of Slaves in the job objects called BadSlaves. Since it’s a job property, you’ll need to save the job after editing it.

I’m hoping it should be something like so:

job = RepositoryUtils.GetJob(“some id of wonderfullness”, True)
job.BadSlaves = []
RepositoryUtils.SaveJob(job)

See if that works out all right for you.

Unfortunately it hasn’t seemed to help.

It seems to update, but the SaveJob(job) does not seem to commit the changes to the database. I have attached a snippet of the code I have been using in the hopes that I have gotten something wrong

[code]j = Deadline.Scripting.RepositoryUtils.GetJob(job.JobId, True)

j.BadSlaves = []

for s in xrange(len(j.BadSlaves)):
print j.BadSlaves[s]

Deadline.Scripting.RepositoryUtils.SaveJob(j)[/code]

When I omit the j.BadSlaves = [], the for loop prints out the names of the slaves as I would expect and the list is blank when the assignment is included. But when I save the job in the last line, and then retrieve the job anew, it has the original list again.

Thanks for all the help, any more would be appreciated :slight_smile:

You know what? It’s failing for me too here. Both on 6.2 and 7.1 (pre-beta build).

I’ll log it as a bug and see what the guys say.

Attaching my example job right-click scripts for others.
Jobs - (Un)ban Slaves.rar (625 Bytes)

Welp, it turns out this won’t get saved. Neither me nor the guy who helped me here realized that at the time…

The good/bad news is it’ll be supported in 7.1. So, you’ll get what you need eventually…

Did this ever get done?
I’m trying to reset the bad slaves in a Python script and nothing happens.

This is my code:

jb = RepositoryUtils.GetJob( jobId, False )
if ( jobResetSlaves != None ):
jb.BadSlaves = []
RepositoryUtils.SaveJob( jb )

Or should this be done differently?

Cheers,

Dave

I hate to do it, but I’m bumping this.

Now that my WebService password problem has been solved ( WebService problem ), I need to work out this problem before I can go live with my online monitor.

Dave

Looks like it has its own function here:

https://docs.thinkboxsoftware.com/products/deadline/10.0/2_Scripting%20Reference/class_deadline_1_1_scripting_1_1_repository_utils.html#ab77cdeea802fb58c16547b9ab58816e9

RepositoryUtils.DeleteAllBadSlaveForJob(jobId)

Regards,

Charles

Thanks once again Charles.
I searched and searched in the scripting reference, and couldn’t find this.

Searching for “BadSlaves” in the scripting reference returns “No Matches” :o(

Thanks,

Dave

Privacy | Site terms | Cookie preferences