Reputation: 4685
Restart all managed instances with all clusters in a rolling restart fashion. Would like the different clusters to restart concurrently
Is there a way to use Jython's threading module to do multiple WLST actions at the same time?
In one script I have classes for both cluster and server instance. A cluster has a list of server instances. There is a method on the cluster object to loop through its list of servers and restart them one by one if the cluster is healthy. I have tried passing this method into a thread like so:
Thread(target=lambda: cluster.managedRestart()).start()
But I receive an error
TypeError: can't set arbitrary attribute in java instance: target
Break out the managed restart code into a seperate file and use execfile()
to call it from within a thread
Upvotes: 4
Views: 1743
Reputation: 965
I don't think threads are to be used explicitly to start the managed servers in parallel. Following code will start all the clusters in parallel. block='false'
will not block the control at the start command which means the start command will be issued and immediately the next command which is starting another cluster is executed. Therefore all the clusters can be started in parallel. Same goes with shutdown
command as well.
connect(username='weblogic', password='weblogic1', url='t3://localhost:7001')
clusterList = ls('/Clusters', returnMap='true')
for cluster in clusterList :
start(cluster, 'Cluster', block='false')
Upvotes: 4