AWS Thinkbox Discussion Forums

Changing Machine Limits Doesn't Actually Modify Mac limits

Hi,
We’ve been noticing that changing machine limits through scripts will change the apparent value on the job settings, but the job won’t pick up any additional jobs to match the machine limit even if the farm is empty. If I go in and change the job settings manually to that number (just increment up one, and then down one to the same value) the job will pick up machines to match the machine limit. Is there something wrong with my code?

def OffsetButtonPressed( *args ):
    global scriptDialog
    
    jobs = MonitorUtils.GetSelectedJobs()
    offset = int( scriptDialog.GetValue( "OffsetBox" ) )
    
    for job in jobs:
        machineLimit = job.MachineLimit + offset
        if machineLimit > 500:
            machineLimit = 500
        elif machineLimit < 0:
            machineLimit = 0
            
        job.MachineLimit = machineLimit
        RepositoryUtils.SaveJob(job)

Thanks for the help!

You need to use RepositoryUtils.SetMachineLimitMaximum( string jobId, int maximum ) to change the machine limit. The MachineLimit property you are using is actually an internal one. The documented property is JobMachineLimit, and that is a read-only property.

Hope that helps!
Ryan

Awesome. Thanks!

Privacy | Site terms | Cookie preferences