Best Python code snippet using localstack_python
Provider.py
Source:Provider.py
...138 name=args['CLUSTER_ID'],139 status="Deleting")140 @DatabaseUpdate()141 def resize_cluster_node_count(self, args):142 results = self.client.modify_cluster(143 ClusterIdentifier=args['CLUSTER_ID'],144 ClusterType=args['type'],145 NumberOfNodes=int(args['nodes']),146 )147 return self.update_status(results=results,148 name=args['CLUSTER_ID'],149 status="resizing")150 @DatabaseUpdate()151 def resize_cluster_to_multi_node(self, args):152 results = self.client.modify_cluster(153 ClusterIdentifier=args['CLUSTER_ID'],154 ClusterType=args['type'],155 NumberOfNodes=int(args['nodes']),156 NodeType=args['nodetype']157 )158 return self.update_status(results=results,159 name=args['CLUSTER_ID'],160 status="Changing node count")161 @DatabaseUpdate()162 def resize_cluster_node_types(self, args):163 results = self.client.modify_cluster(164 ClusterIdentifier=args['CLUSTER_ID'],165 NodeType=args['nodetype'],166 NumberOfNodes=int(args['nodes'])167 )168 return self.update_status(results=results,169 name=args['CLUSTER_ID'],170 status="Changing node types")171 @DatabaseUpdate()172 def modify_cluster(self, args):173 VERBOSE("in modify")174 results = self.client.modify_cluster(175 ClusterIdentifier=args['CLUSTER_ID'],176 MasterUserPassword=args['newpass']177 )178 return self.update_status(results=results,179 name=args['CLUSTER_ID'],180 status="Modifying password")181 @DatabaseUpdate()182 def rename_cluster(self, args):183 VERBOSE("in rename")184 results = self.client.modify_cluster(185 ClusterIdentifier=args['CLUSTER_ID'],186 NewClusterIdentifier=args['newid'],187 )188 return self.update_status(results=results,189 name=args['CLUSTER_ID'],190 status="Renaming")191 # {'describe': False, 'CLUSTER_ID': 'cl13',192 # 'create': False, 'DB_NAME': None, 'USER_NAME': None, 'PASSWD': None, '--nodetype': 'dc1.large',193 # '--type': 'single-node', '--nodes': '1',194 # 'resize': False, 'modify': True, '--newid': 'cl14', '--newpass': None,195 # 'delete': False,196 # 'type': 'single-node', 'nodetype': 'dc1.large', 'nodes': '1', 'newid': 'cl14', 'newpass': None}197 #198 #...
main.py
Source:main.py
...52 train_fl_out[ts][s] = sum(train_fl[ts][s])53 for z in range(zone):54 train_fl_in[ts][s] += train_fl[ts][z][s]55 # Modify cluster based on demand flows56 assignment = modify_cluster(cluster, assignment, centre, zone, cp, ds, mindis, trainsample, train_fl)57 print("Clusters generated.")58 # Initialize global intra-cluster rebalancing result59 yp_total = [0.0 for s in range(zone)]60 yn_total = [0.0 for s in range(zone)]61 bn = [[0 for s in range(zone)] for v in range(vec)]62 # Intra-cluster rebalancing63 for c in range(cluster):64 # Extract local data65 local_list = [s for s in range(zone) if assignment[s] == c]66 local_zone = len(local_list)67 local_cp = [cp[s] for s in local_list]68 local_ds = [ds[s] for s in local_list]69 local_vec_list = []70 local_vec = 0...
modify_cluster.py
Source:modify_cluster.py
1def modify_cluster(cluster, assignment, centre, zone, cp, ds, mindis, trainsample, train_fl):2 """3 Modify clusters based on demands flow4 Returns5 ----------6 assignment: array, dtype=int, size=zone7 updated assignment of each station to cluster8 """9 from modify_cluster.compute_orig_loss import compute_orig_loss10 from modify_cluster.compute_average_loss import compute_average_loss11 # Compute original loss12 loss = compute_orig_loss(zone, cp, ds, trainsample, train_fl)13 # Compute ALg14 AL = compute_average_loss(loss)15 ...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!