Trying to update Worker Settings using the API, I keep getting the message ‘Error: Must provide a SlaveSettings object to save.’ when issuing the PUT method call to /api/slaves. This happens even when I send it an unmodified settings block from the GET method call to that same endpoint. When I tried to replicate the error in the Python Standalone library, I get the same message, even when using the unmodified object from the get call. Using Deadline 10.1.21.4. Any thoughts on why this is kicking back the update request? Thanks!
Would you be able to share the code you’re using to GET and PUT the settings object?
I do see that the save settings won’t directly take the output from the GET, it needs a JSON object with Command and the settings JSON itself.
It may be reading the wrong part of your PUT expecting it to be a SlaveSettings object.
Hi Justin,
I got the PUT command to execute, using the code below.
import requests
def main():
result = requests.get('https://192.168.50.46:4434/api/slaves?Name=deadline-worker-2&Data=settings', verify=False)
workersettings = result.json()
print(workersettings)
workersettings[0]['Desc'] = "test"
requestdict = {"Command": "savesettings", "SlaveInfo": workersettings}
saveresult = requests.put('https://192.168.50.46:4434/api/slaves', verify= False, data = requestdict)
print(saveresult.status_code)
print(saveresult.reason)
if __name__ == '__main__':
main()
But I noticed that it doesn’t change the worker’s data in the repository. The response looks like it executed correctly, though. Other calls like setGroup and setPool seem to work fine through the API. Any help would be great, thanks!
Here’s a more complete test program. The call to add a group to the worker is fine, the save settings call returns 200 OK, but doesn’t do anything.
import json
import requests
def main():
workersettingstest()
def groupsettingstest():
requestdict = {"Slave": "deadline-worker-2", "Group": "lucklight"}
result = requests.put('https://192.168.50.46:4434/api/groups', verify=False, data=json.dumps(requestdict))
print(result.status_code, result.reason)
result = requests.get('https://192.168.50.46:4434/api/slaves?Name=deadline-worker-2&Data=settings', verify=False)
workersettings = result.json()
print(workersettings)
def workersettingstest():
result = requests.get('https://192.168.50.46:4434/api/slaves?Name=deadline-worker-2&Data=settings', verify=False)
workersettings = result.json()
print(workersettings)
workersettings[0]['Cmmt'] = "test"
requestdict = {"Command": "savesettings", "SlaveInfo": workersettings}
saveresult = requests.put('https://192.168.50.46:4434/api/slaves', verify= False, data = json.dumps(requestdict))
print(saveresult.status_code)
print(saveresult.reason)
if __name__ == '__main__':
main()
I’ve got mixed results, I don’t get any errors from that script, but the changes also aren’t saved.
I’m running Deadline 10.2.0.8, and running this through Python 3.8.5, what are you running locally?
Also I’ll be out for the next two weeks - it may be best to open a ticket with us a awsthinkbox.zendesk.com as we’ve got a better ownership+followup mechanism in the ticket system, so we can ensure someone on the support team can help out.
Deadline 10.1.21.4, Python 3.10.4
The text for the response is ‘Error: Must provide a SlaveSettings object to save.’, even though the response is 200, so it is letting me know that the update isn’t being processed. I guess the quest for the correct settings object format continues.
I sorted this out finally, the documentation is incorrect. The proper Key for the json body is ‘SlaveSettings’, not ‘SlaveInfo’.
I’ll get a ticket in to update those docs, thanks for letting us know!
Thanks Justin, I think it’s been fixed in the newest doc releases, but some of the older ones still have the wrong attribute.