예제 #1
0
    def setNodeFrequencyPercent(self,argList):
        parser = argparse.ArgumentParser(description="Sets the cores of a node to a frequency")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        parser.add_argument("-c","--cores",type=str,required=True)
        parser.add_argument("-f","--frequency",type=float,required=True)

        args = parser.parse_args(argList)
        
        ClusterRequest = ClusterMessages.SetNodeCoreFrequencyPercentRequest()
        ClusterRequest.Node_ID = args.node
        ClusterRequest.Core_List = args.cores
        ClusterRequest.Frequency = args.frequency
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Set_Node_Core_Frequency_Percent(ClusterRequest)                 
                if False == response.Success:
                    errorStr = "{0} calling Set_Node_Core_Frequency_Percent()".format(response.Reason)
                    logger.error(errorStr)
                    logger.error("Is the govenror set to userspace?")

                else:
                    logger.info("Successful call to Set_Node_Core_Frequency_Percent()")

        except Exception as ex:
            errorStr = "{0} calling Set_Node_Core_Frequency_Percent()".format(ex)
            logger.error(errorStr)
예제 #2
0
    def setNodeGovernor(self,argList):
        parser = argparse.ArgumentParser(description="Sets the frequency governor for the cores of a node")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        parser.add_argument("-c","--cores",help='ex. 1-4,6,7,32-50',type=str,required=True)
        parser.add_argument("-g","--governor",help='run getNodeInfo to find out available governors',type=str,required=True)

        args = parser.parse_args(argList)
        
        ClusterRequest = ClusterMessages.SetNodeGovenorRequest()
        ClusterRequest.Node_ID = args.node
        ClusterRequest.Core_List = args.cores
        ClusterRequest.Core_Govenor = args.governor
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Set_Node_Core_Govenor(ClusterRequest)                 
                if False == response.Success:
                    errorStr = "{0} calling Set_Node_Core_Govenor()".format(response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Set_Node_Core_Govenor()")

        except Exception as ex:
            errorStr = "{0} calling Set_Node_Core_Govenor()".format(ex)
            logger.error(errorStr)
예제 #3
0
    def getNodeInfo(self,argList): 
        parser = argparse.ArgumentParser(description="Gets info on specific core on a node")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        args = parser.parse_args(argList)

        ClusterRequest = ClusterMessages.NodeIdentifier()
        ClusterRequest.Node_ID = args.node
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Get_Node_CPU_Info(ClusterRequest)                 
                if False == response.Response.Success:
                    errorStr = "{0} calling Get_Node_CPU_Info()".format(response.Response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Get_Node_CPU_Info()")
                    coreCount = response.CoreCount
                    govStr = ",".join(response.Supported_Scaling_Governor)
                    csStr = ",".join(response.Supported_CState)
                    pprint("Node: {0} Core Count: {1} Available Governors: {2} Available CStates: {3}".format(args.node,coreCount,govStr,csStr))

        except Exception as ex:
            errorStr = "{0} calling Get_Node_CPU_Info()".format(ex)
            logger.error(errorStr)            
예제 #4
0
    def getNodeCoreInfo(self,argList): 
        parser = argparse.ArgumentParser(description="Gets the info of a specific core on a specific node")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        parser.add_argument("-c","--corenum",help='core number to get info on',type=int,required=True)
        args = parser.parse_args(argList)

        ClusterRequest = ClusterMessages.NodeCoreIdentifier()
        ClusterRequest.Node_ID = args.node
        ClusterRequest.CoreNumber = args.corenum
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Get_Node_Core_Info(ClusterRequest)                 
                if False == response.Response.Success:
                    errorStr = "{0} calling Get_Core_FreGet_Node_Core_Infoquency_Info()".format(response.Response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Get_Core_Frequency_Info()")
                    pprint("Node {} Core {} Frequency Range: Max: {} Min:{} Current Freq: {} Current Scaling Governor: {}".format(args.node,args.corenum,response.MaxFrequency,response.MinFrequency,response.CurrentFrequency,response.Current_Scaling_Governor))
                    
        except Exception as ex:
            errorStr = "{0} calling Get_Node_Core_Info()".format(ex)
            logger.error(errorStr)            
예제 #5
0
    def randomizeClusterFrequency(self,argsList):
        ClusterRequest = ClusterMessages.Empty()
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Set_Cluster_Random_Frequencies(ClusterRequest)                 
                if False == response.Success:
                    errorStr = "{0} calling Set_Cluster_Frequency_Random()".format(response.Reason)
                    logger.error(errorStr)
                    logger.error("Is the governor set to userspace?")

                else:
                    logger.info("Successful call to Set_Cluster_Frequency_Random()")

        except Exception as ex:
            errorStr = "{0} calling Set_Cluster_Frequency_Random()".format(ex)
            logger.error(errorStr)
예제 #6
0
    def getClusterNodes(self,argList):
        ClusterRequest = ClusterMessages.Empty()
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Get_Cluster_Nodelist(ClusterRequest)                 
                if False == response.Response.Success:
                    errorStr = "{0} calling Get_Cluster_Nodelist()".format(response.Response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Get_Cluster_Nodelist()")
                    pprint("--- Node Frequency Manager Nodes ---")
                    for node in response.Node:
                        pprint(node.Node_ID)
                    

        except Exception as ex:
            errorStr = "{0} calling Get_Cluster_Nodelist()".format(ex)
            logger.error(errorStr)
예제 #7
0
    def setClusterPercentFrequency(self,argList):
        parser = argparse.ArgumentParser(description="Set entire cluster to specified frequency percentage")
        parser.add_argument("-f","--frequency",type=int)
        args = parser.parse_args(argList)

        ClusterRequest = ClusterMessages.SetClusterFrequencyPercentRequest()
        ClusterRequest.Frequency = args.frequency
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Set_Cluster_Core_Frequency_Percent(ClusterRequest)                 
                if False == response.Success:
                    errorStr = "{0} calling Set_Cluster_Core_Frequency_Percent()".format(response.Reason)
                    logger.error(errorStr)
                    logger.error("Is the governor set to userspace?")

                else:
                    logger.info("Successful call to Set_Cluster_Core_Frequency_Percent()")

        except Exception as ex:
            errorStr = "{0} calling Set_Cluster_Core_Frequency_Percent()".format(ex)
            logger.error(errorStr)
예제 #8
0
    def setNodeCState(self,argList):
        parser = argparse.ArgumentParser(description="Sets the cstate of cores on  a node")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        parser.add_argument("-c","--cores",type=str,required=True)
        parser.add_argument("-m","--name",help='name of CState (ex. POLL,C1,C1E,C6)', type=str,required=True)
        grpEnableDisable = parser.add_mutually_exclusive_group()

        grpEnableDisable.add_argument("-e","--enable",help='enable  CState', action='store_true')
        grpEnableDisable.add_argument("-d","--disable",help='disable  CState', action='store_true')

        args = parser.parse_args(argList)
        
        ClusterRequest = ClusterMessages.SetNodeCStateRequest()
        ClusterRequest.Node_ID = args.node.strip()
        ClusterRequest.Core_List = args.cores
        ClusterRequest.Core_CState = args.name.strip()

        if True == args.enable:
            ClusterRequest.State = 0
        else:
            ClusterRequest.State = 1
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Set_Node_Core_CState(ClusterRequest)                 
                if False == response.Success:
                    errorStr = "{0} calling Set_Node_Core_CState()".format(response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Set_Node_Core_CState()")

        except Exception as ex:
            errorStr = "{0} calling Set_Node_Core_CState()".format(ex)
            logger.error(errorStr)
예제 #9
0
    def getNodeFrequencyRange(self,argList):
        parser = argparse.ArgumentParser(description="Gets the Min and Max Frequency Range for a node")
        parser.add_argument("-n","--node",help='fqdn of where the NFM service is running',type=str,required=True)
        args = parser.parse_args(argList)

        ClusterRequest = ClusterMessages.NodeIdentifier()
        ClusterRequest.Node_ID = args.node
        
        try:
            with grpc.insecure_channel(self.target) as channel:
                rpcStub = ClusterRPC.ClusterFrequencyManagerServiceStub(channel)
                response = rpcStub.Get_Node_Frequency_Range(ClusterRequest)                 
                if False == response.Response.Success:
                    errorStr = "{0} calling Get_Node_Frequency_Range()".format(response.Response.Reason)
                    logger.error(errorStr)

                else:
                    logger.info("Successful call to Get_Node_Frequency_Range()")
                    pprint("Node {} Frequency Range: Max: {} Min:{}".format(args.node,response.MaxFrequency,response.MinFrequency))
                    

        except Exception as ex:
            errorStr = "{0} calling Get_Node_Frequency_Range()".format(ex)
            logger.error(errorStr)