AWS Thinkbox Discussion Forums

What's the code to blacklist a slave?

Hey,

I looked through the documentation, but I couldn’t find the answer…

I know how to get the slave name using:

RepositoryUtils.GetJobTasks( currentJob, True ).GetTask(0).TaskSlaveName
But how can I then blacklist this machine, should I need to?

Thanks,
Shaun

Basic workflow to blacklist a Slave:

  • Get the Job/Job ID
  • Make sure the job is using a blacklist (not a whitelist)
  • Add the Slave name to the list of machines on that list

RepositoryUtils has some functions to help

Here’s a super basic example:

job_id = "some_job_id"
bad_slave = "a_very_naughty_slave"
is_white_list = False

# Set Job's Machine List to a black list
RepositoryUtils.SetMachineLimitWhiteListFlag( job_id, is_white_list )

# Adds the new bad slave.
RepositoryUtils.AddSlavesToMachineLimitList( job_id, bad_slave )

Note: A different way to accomplish is by directly modifying the Job object that you have, but you’ll need to save it back to the Database after making your changes.

That’s entirely up to you, what are you trying to accomplish with programmatically blacklisting a Slave (in this case, the Slave on task 0)? Is your example what you’re planning on doing?

Cheers

1 Like

Hi Mepp,

That’s really helpful, thank you.

We sometimes have artists machines go on the the farm and the don’t have the correct versions of software installed, so I want to adjust the Houdini plugin, to scan for the line "Error starting “C:\Program Files\Side Effects Software.*” and then blacklist the slave that produced it :smiley:

It should be pretty straight forward using your code. Thank you!

Hmm, that’s definitely one way to get it to work, though I think using groups might be better (and less work for you)!

Excerpt from our docs on groups and pools:

The gist of it here, is that if you can create groups for the applicable Houdini versions, and assign them (on submission) to the jobs. This way, artist machines that don’t have the right version for the job won’t attempt to render it by accident.

Let me know if that works for you.

Cheers

Hey,

Yeah, cool that largely works. Except in cases when a machine was powered off when we updated the farm/workstations with software - then we end up with one or two rogue machines that haven’t got the right version.

This attempt to blacklist a slave using the code is my little fail-safe idea :smiley:

All done. Thanks again for the help.

Glad you got something that works for you :smiley:!

Cheers

Privacy | Site terms | Cookie preferences