def main(): myLogger = MyLogger(LOGFILE="/tmp/MyElement.log", STDOUT=True, DEBUG=True) myObject = MyElement(myLogger, name="name", value="Denis value") myObject.logIt("main(): Hello world\n") myObject.debug("main(): Debug Hello world\n") print("name=" + myObject.getName()) print("value=" + myObject.getValue()) myObject.setName("bulltwinkie") myObject.setValue("real tasty") print("name=" + myObject.getName()) print("value=" + myObject.getValue()) for i in range(0, 10): myAttribute = MyAttribute(logger=myLogger, name="name" + str(i), value="value" + str(i)) myObject.addAttribute(myAttribute) # Endfor for i in range(0, 10): myAttribute = myObject.getAttributeByName("name" + str(i)) print("attr name=" + myAttribute.getName()) print("attr value=" + myAttribute.getValue()) # Endfor myAttrs = myObject.getAllAttributes() for attr in myAttrs: print(attr.getName()) print(attr.getValue()) myObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/StopAllRunnableProcesses.log", STDOUT=True, DEBUG=True) threadList = [] processDict = dict() for mythread in range(0, 3): hostName = 'host' + str(mythread) processList = [ 'comp' + str(mythread + 1), 'comp' + str(mythread + 2), 'comp' + str(mythread + 3) ] processDict[hostName] = processList # Endfor jobid = 'SomeAutoSysId' ampid = 'SomeAmpId' mne = 'DMP' statusFile = '/tmp/stop_all_runable_processes.MYDOMAIN' myStopAllRunnableProcesses = StopAllRunnableProcesses(jobid, ampid, 'MYDOMAIN', mne, statusFile, processDict, logger=myLogger) rc = myStopAllRunnableProcesses.stopProcesses() msgs = myStopAllRunnableProcesses.message myLogger.logIt("main(): msgs=" + str(msgs) + "\n") myStopAllRunnableProcesses.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/MakeNewFilesActive.log", STDOUT=True, DEBUG=True) threadList = [] hostDict = dict() for mythread in range(0, 3): hostName = 'host' + str(mythread) hostDict[hostName] = False # Endfor jobid = 'SomeAutoSysId' ampid = 'SomeAmpId' mne = 'DMP' statusFileHome = '/tmp' myMakeNewFilesActive = MakeNewFilesActive(jobid, ampid, 'MYDOMAIN', mne, statusFileHome, hostDict, logger=myLogger) rc = myMakeNewFilesActive.makeFilesActive() msgs = myMakeNewFilesActive.message myLogger.logIt("main(): msgs=" + str(msgs) + "\n") myMakeNewFilesActive.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/ConfigWebServers.log", STDOUT=True, DEBUG=True) threadList = [] hostDict = dict() for mythread in range(0, 3): hostName = 'host' + str(mythread) hostDict[hostName] = ['arg1', 'arg2', 'arg3'] # Endfor jobid = 'SomeAutoSysId' ampid = 'SomeAmpId' mne = 'DMP' statusFileHome = '/tmp' myConfigWebServers = ConfigWebServers(jobid, ampid, mne, 'MYDOMAIN', hostDict, statusFileHome, logger=myLogger) myConfigWebServers.configWebServers(timeout=5.0) myLogger.logIt('main(): ' + str(myConfigWebServers.message)) myConfigWebServers.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/WasData.log", STDOUT=True, DEBUG=True) #adminObject = AdminClient( logger=myLogger, hostname="dilabvirt31-v1" ) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') myclient = None try: myclient = adminObject.createSOAPDefault() except: myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise wasDataObject = WasData(logger=myLogger) wasDataObject.queryWAS(myclient, query="WebSphere:*") #print dir( wasDataObject.objectNames[0] ) #print str( wasDataObject.objectNames[0].toString() ) wasDataObject.writeData("/nfs/home4/dmpapp/appd4ec/tmp/wastest2.csv") for data in wasDataObject.sortedObjectNames: myLogger.logIt(str(data.toString()) + '\n') #Endfor myattrs = wasDataObject.getAllPossibleAttributes() for attr in wasDataObject.attributes: myLogger.logIt(attr + '\n') #Endif wasDataObject.closeMe() adminObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/MakeNewFilesActiveThread.log", STDOUT=True, DEBUG=True) mne = 'DMP' statusFile = '/tmp/stop_all_runable_processes.MYDOMAIN' jobid = 'SomeAutoSysJobId' ampid = 'SomeAmpId' threadList = [] for mythread in range(0, 3): current = MakeNewFilesActiveThread(jobid, ampid, 'host' + str(mythread + 1), 'MYDOMAIN', statusFile + str(mythread + 1), mne, cleanFlag=True, threadName=str(jobid) + '_' + str(ampid) + '_MYDOMAIN' + '_host' + str(mythread + 1), logger=myLogger) threadList.append(current) current.start() # Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") mythread.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/StopRunnableProcessThread.log", STDOUT=True, DEBUG=True) mne = 'DMP' statusFile = '/tmp/stop_all_runable_processes.MYDOMAIN' jobid = 'SomeAutoSysJobId' ampid = 'SomeAmpId' threadList = [] for mythread in range(0, 3): processList = list() processList = ['comp' + str(mythread + 1), 'comp' + str(mythread + 2), 'comp' + str(mythread + 3)] current = StopRunnableProcessThread( jobid, ampid, 'host' + str(mythread + 1), 'MYDOMAIN', statusFile + str(mythread + 1), mne, processList, threadName='thread_jobid_' + str(mythread) + '_host' + str(mythread + 1), logger=myLogger ) threadList.append(current) current.start() # Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") mythread.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/ConfigureWASThread.log", STDOUT=True, DEBUG=True) mne = 'DMP' statusFile = '/tmp' jobid = 'SomeAutoSysJobId' ampid = 'SomeAmpId' threadList = [] componentList = ['comp1', 'comp2', 'comp3', 'comp4'] for mythread in range(0, 3): for component in componentList: current = ConfigureWASThread( jobid, ampid, 'host' + str(mythread + 1), statusFile, mne, component, threadName='thread_jobid_' + str(mythread) + '_host' + str(mythread + 1) + '_' + str(component), logger=myLogger ) threadList.append(current) current.start() # Endfor # Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") mythread.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/ConfigureWAS.log", STDOUT=True, DEBUG=True) threadList = [] hostDict = dict() for mythread in range(0, 3): hostName = 'host' + str(mythread) hostDict[hostName] = ['comp1', 'comp2', 'comp3'] # Endfor jobid = 'SomeAutoSysId' ampid = 'SomeAmpId' mne = 'DMP' # statusFileHome = '/tmp/stop_all_runable_processes.MYDOMAIN' statusFileHome = '/tmp' myConfigureWAS = ConfigureWAS( jobid, ampid, mne, 'MYDOMAIN', hostDict, statusFileHome, logger=myLogger ) myConfigureWAS.configureWAS(timeout=5.0) myLogger.logIt('main(): ' + str(myConfigureWAS.message)) myConfigureWAS.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/WasClusters.log", STDOUT=True, DEBUG=True) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1") try: myclient = adminObject.createSOAPDefault() results = adminObject.getResults() adminObject.logResults(results) myClusterObject = WasClusters(logger=myLogger) clusterMembers = myClusterObject.getClusterMembers(myclient) print dir(myClusterObject.clusterMembers) for clusterMember in clusterMembers: #print dir( clusterMember ) print clusterMember.clusterName print clusterMember.memberName print clusterMember.type print clusterMember.nodeName print clusterMember.uniqueID print clusterMember.clusterObjectName.toString() print clusterMember.weightTableEntry.memberName print clusterMember.weightTableEntry.weight print clusterMember.weightTableEntry.nodeName #Endif adminObject.closeMe() except: myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise
def main(): myLogger = MyLogger(LOGFILE="/tmp/ConfigureMNEThread.log", STDOUT=True, DEBUG=True) mne = 'DMP' statusFile = '/tmp/configureMNE.MYDOMAIN' jobid = 'SomeAutoSysJobId' ampid = 'SomeAmpId' threadList = [] for mythread in range(0, 3): current = ConfigureMNEThread( jobid, ampid, 'host' + str(mythread + 1), statusFile + str(mythread + 1), mne, threadName='thread_jobid_' + str(mythread) + '_host' + str(mythread + 1), logger=myLogger ) threadList.append(current) current.start() # Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") mythread.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/FileThread.log", STDOUT=True, DEBUG=True) mySocketObj = MySocket(port=50007, logger=myLogger) mySocketObj.bindAndListen() conn, data = mySocketObj.serverRead(1, packetSize=2048) statusFile = '/tmp/mystatus.txt' threadList = [] for mythread in range(0, 1): current = FileThread(mySocketObj, conn, data, statusFile + str(mythread + 1), threadName='thread_jobid_' + str(mythread) + '_host' + str(mythread + 1), logger=myLogger) threadList.append(current) current.start() # Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") myLogger.logIt("main(): " + str(mythread.message) + '\n') mythread.closeMe()
def resetInit(myopts): """Reset the initialize values based on what the user specified on the command line.""" for my_opt in myopts.keys(): CONFIG[my_opt] = myopts[my_opt] #print( my_opt + '=' + str( CONFIG[my_opt] ) ) #Endfor CONFIG['utils'] = MyLogger(LOGFILE=CONFIG['logfile'], STDOUT=CONFIG['stdout'], DEBUG=CONFIG['debug']);
def main(): myLogger = MyLogger(LOGFILE="/tmp/Environment.log", STDOUT=True, DEBUG=False) myObject = Environment(logger=myLogger) myObject.logMySelf(debugOnly=False) myObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/FileTask.log", STDOUT=True, DEBUG=True) statusFileHome = '/tmp' myFileTask = FileTask(port=50007, statusFileHome=statusFileHome, logger=myLogger) myFileTask.fileTask(timeout=None) myLogger.logIt('main(): ' + str(myFileTask.message))
def main(): myLogger = MyLogger(LOGFILE="/tmp/MySocket.log", STDOUT=True, DEBUG=False) myObject = MySocket(logger=myLogger) myObject.logMySelf(debugOnly=False) myObject.bindAndListen() conn, data = myObject.serverRead(1, packetSize=1024) myObject.serverSend(conn, data) conn.close() myObject.closeMe();
def main(): myLogger = MyLogger( LOGFILE="/tmp/AppServerManager.log", STDOUT=True, DEBUG=True ) adminObject = AdminClient( logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA' ) try: myclient = adminObject.createSOAPDefault() results = adminObject.getResults() #adminObject.logResults( results ) except Exception, e: myLogger.logIt( "main(): " + str(e) + "\n" ) myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise
def main(): myLogger = MyLogger( LOGFILE="/tmp/WasEnvironment.log", STDOUT=True, DEBUG=False ) myObject = WasEnvironment(domain="V6_DEV", logger=myLogger) #myObject2 = WasEnvironment(domain="V6_DEV", logger=myLogger); print myObject.getWasEnv() print myObject.getDomain() print myObject.getDomainEnv() print myObject.getDomainVersion() print myObject.getDomainHome() myObject.logMySelf( debugOnly=False ) myObject.closeMe();
def main(): myLogger = MyLogger(LOGFILE="/tmp/DomainDeployOperationThread.log", STDOUT=True, DEBUG=True) mne = 'DMP' statusFile = '/tmp/deploy_DOMAIN_components.MYDOMAIN' statusFilesHome = '/tmp' jobid = 'SomeAutoSysJobId' ampid = 'SomeAmpId' threadList = [] for mythread in range(0, 3): processDict = dict() processDict['host1'] = [ 'comp' + str(mythread + 1), 'comp' + str(mythread + 2), 'comp' + str(mythread + 3) ] processDict['host2'] = [ 'comp' + str(mythread + 1), 'comp' + str(mythread + 2), 'comp' + str(mythread + 3) ] processDict['host3'] = [ 'comp' + str(mythread + 1), 'comp' + str(mythread + 2), 'comp' + str(mythread + 3) ] hostDict = dict() hostDict['host1'] = [False] hostDict['host2'] = [False] hostDict['host3'] = [False] current = DomainDeployOperationThread(jobid, ampid, 'MYDOMAIN' + str(mythread), statusFile + str(mythread), statusFilesHome, mne, processDict, hostDict, threadName='MAIN_MYDOMAIN' + str(mythread), logger=myLogger) threadList.append(current) current.start() #Endfor ################################ # Join on all the threads. ################################ for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") myLogger.logIt("main(): " + str(mythread.message) + '\n') mythread.closeMe()
def resetInit(myopts): """Reset the initialize values based on what the user specified on the command line.""" for my_opt in list(myopts.keys()): CONFIG[my_opt] = myopts[my_opt] # print( my_opt + '=' + str( CONFIG[my_opt] ) ) # Endfor if int(CONFIG['number']) > 9999 or int(CONFIG['number']) < 0: print("--number is not valid.") usage() sys.exit(2) CONFIG['utils'] = MyLogger(LOGFILE=CONFIG['logfile'], STDOUT=CONFIG['stdout'], DEBUG=CONFIG['debug']);
def main(): """Unit testing.""" myLogger = MyLogger(LOGFILE="/tmp/MyXML.log", STDOUT=True, DEBUG=True) myObject = MyXML( myLogger, URI= "file:///nfs/dist/trp/amp/update/UAT/QUAL/QAMP_UAT0000000_090504130000i/QAMP_UAT0000000_090504130000i.xml" ) myObject.logIt("main(): Hello world\n") myObject.debug("main(): Debug Hello world\n") result = myObject.xpathQuery( "/applicationUpdateProperties/updateParameters/ccid") ar = myObject.getElementInfo(result) print(type(ar)) print(ar) for el in ar: myObject.logMyElement(el) # myObject.printMyElement( el ) result = myObject.xpathQuery( "/applicationUpdateProperties/updateParameters/ccid", offset=0) print(type(ar)) print(ar) for el in ar: myObject.logMyElement(el) # myObject.printMyElement( el ) result = myObject.xpathQuery( '/applicationUpdateProperties/runtimeHostDeploymentProperties/hostApplicationLists/hostApplicationList[@hostName="didmgr11"]', offset=0) print(type(result)) ar = myObject.getElementInfo(result) print(type(ar)) print(ar) for el in ar: myObject.logMyElement(el) # myObject.printMyElement( el ) result = myObject.xpathQuery( '/applicationUpdateProperties/applicationComponentConfigurations/applicationConfigurations/domainApplicationComponentConfiguration/runtimeFiles' ) ar = myObject.getElementInfo(result) print(type(ar)) print(ar) for el in ar: myObject.logMyElement(el) # myObject.printMyElement( el ) # print type( result ) # print ar myObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/StopAllRunnableProcesses.log", STDOUT=True, DEBUG=True) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') try: myclient = adminObject.createSOAPDefault() results = adminObject.getResults() # adminObject.logResults( results ) except Exception as e: myLogger.logIt("main(): " + str(e) + "\n") myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise # Endtry mycell = "ServicesA" mynodeName = "node_ServicesA_01" myserver = "as_wdt_01" myappName = "DamnSchappettEA" mycluster = "cl_ServicesA_a" rc = False # scope = "Cell=" + str( mycell ) + ":Node=" + str( mynodeName ) + ":Cluster=" + str( mycluster ) + ":Server=" + str( myserver ) # scope = "Cell=" + str( mycell ) + ":Node=" + str( mynodeName ) + ":Server=" + str( myserver ) configService = ConfigService(adminClient=myclient, logger=myLogger) myStopAllRunnableProcesses = StopAllRunnableProcesses(adminObject, configService, logger=myLogger) threadList = [] for mythread in range(0, 3): current = StopAllRunnableProcesses(adminObject, configService, threadName='thread' + str(mythread), logger=myLogger) threadList.append(current) current.start() # Endfor for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") # Endfor myStopAllRunnableProcesses.closeMe() adminObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/WASServerClusterTasks.log", STDOUT=True, DEBUG=True) #wasAdminClient = WASAdminClient( "dilabvirt31-v1", None, None, None ) wasAdminClient = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') myclient = wasAdminClient.createRMIDefault() configServiceProxy = ConfigServiceProxy(myclient) myObject = WASServerClusterTasks(configService=configServiceProxy, logger=myLogger) print dir(myObject) myObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/StatusCookie.log", STDOUT=True, DEBUG=True) myObject = StatusCookie(jobname="QAMP_UAT0000000_090504130000i", logger=myLogger) if (myObject is None): print("Failed to create the StatusCookie object.") email_dir = myObject.getEmailDir() myLogger.logIt("email_dir=" + str(email_dir) + "\n") work_dir = myObject.getWorkDir() myLogger.logIt("work_dir=" + str(work_dir) + "\n") myObject.writeStatus(host="dideploy11", app="StatusCookie", msg="This is a test") myObject.closeMe()
def main(): myLogger = MyLogger(LOGFILE="/tmp/AdminClient.log", STDOUT=True, DEBUG=True) myObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') try: myclient = myObject.createSOAPDefault() results = myObject.getResults() myObject.logResults(results) myObject.closeMe() except: myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" )
def resetInit(myopts): """Reset the initialize values based on what the user specified on the command line.""" for my_opt in list(myopts.keys()): CONFIG[my_opt] = myopts[my_opt] # print( my_opt + '=' + str( CONFIG[my_opt] ) ) # Endfor CONFIG['utils'] = MyLogger(LOGFILE=CONFIG['logfile'], STDOUT=CONFIG['stdout'], DEBUG=CONFIG['debug']) # CONFIG['utils'].logIt( "resetInit(): Here I am.\n" ); CONFIG['cookie'] = StatusCookie(jobname=CONFIG['jobname'], logger=CONFIG['utils']) CONFIG['work_dir'] = CONFIG['cookie'].getWorkDir() CONFIG['xml_file'] = CONFIG['work_dir'] + "/" + CONFIG['jobname'] + ".xml" CONFIG['fqdn'] = "dapp41:31854" CONFIG['userid'] = "appd4ec" CONFIG['password'] = "******" CONFIG['master_file'] = "daemons.master"
def main(): myLogger = MyLogger(LOGFILE="/tmp/ConfigService.log", STDOUT=True, DEBUG=True) #adminClient = AdminClient( logger=myLogger, hostname="dilabvirt31-v1" ) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') try: myconn = adminClient.createSOAPDefault() print dir(myconn) myObject = ConfigService(myconn, logger=myLogger) tmyconn = myObject.getAdminClient() print dir(tmyconn) print dir(myObject) print dir(myObject.systemAttributes) print dir(myObject.sessionPropertyConstants) myObject.closeMe() except Exception, e: myLogger.logIt( "main(): Unable to connect to the AdminClient. Make sure that the WAS Manager is running.\n" + str(e) + "\n")
def main(): myLogger = MyLogger(LOGFILE="/tmp/AppManagementService.log", STDOUT=True, DEBUG=True) #adminClient = AdminClient( logger=myLogger, hostname="dilabvirt31-v1" ) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') try: myconn = adminClient.createRMIDefault() print dir(myconn) myObject = AppManagementService(logger=myLogger) myAppManagementClient = myObject.getJMXProxyForClient(myconn) #myAppManagementServer = myObject.getJMXProxyForServer() myAppManagementLocal = myObject.getLocalProxy() print dir(myAppManagementClient) #print dir( myAppManagementServer ) print dir(myAppManagementLocal) print dir(myObject) print dir(myObject.appConstants) myObject.closeMe() adminClient.closeMe() except Exception, e: myLogger.logIt("main(): " + str(e) + "\n")
def main(): myLogger = MyLogger(LOGFILE="/tmp/WasObject.log", STDOUT=True, DEBUG=True)
def main(): myLogger = MyLogger(LOGFILE="/tmp/WasSession.log", STDOUT=True, DEBUG=True) myObject = WasSession(userName="******", logger=myLogger)