Using this example from the documents, selecting more than one instance (for example 3) returns 3 copies of the same instance such as 1,1,1 instead of 1,2,3.
import MConsoleAPI
err, list = MConsoleAPI.getInstancesViewSelection()
if (err.getErrorCode() != 0): sys.exit(err.getDescription())
for nodeId in list:
err, nodeObj = MConsoleAPI.nodeGet(nodeId)
if (err.getErrorCode() ==0): print(“Selected instance: ” + nodeObj.getInstanceName())
My code here:
import MConsoleAPI
err, list = MConsoleAPI.getInstancesViewSelection()
if (err.getErrorCode() != 0): sys.exit(err.getDescription())
print(list)
for nodeId in list:
print(nodeId)
err, nodeObj = MConsoleAPI.nodeGet(nodeId)
print(“Selected instance: ” + nodeObj.getInstanceName())
ramUsage = nodeObj.getRamUsage()
splitRamUsage = ramUsage.split()
print(splitRamUsage[0])
Will return the first instance selected for every instance selected.
This is a bug and has been fixed in the latest releases
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
We use cookies to ensure that we give you the best experience on our website Cookies are also used to send anonymous browsing data to Google Analytics. We give you the option to Refuse our cookies.