Best Python code snippet using localstack_python
Scale_Shards.py
Source:Scale_Shards.py
...76 response = firehose.put_record(DeliveryStreamName=firehose_name, Record={'Data': json.dumps({u'Timestamp': strftime("%a, %d %b %Y %H:%M:%S", gmtime()), u'OpenShards': n_open_shards, u'IncomingBytes': bytes_per_s, u'IncomingRecords': records_per_s})})77 78 # Adding shards79 if bytes_per_s/(60*1024) > byte_upper * n_open_shards or records_per_s/60 > record_upper * n_open_shards:80 kinesis.update_shard_count(81 StreamName=stream_name,82 TargetShardCount=n_open_shards + 1,83 ScalingType='UNIFORM_SCALING'84 )85 86 # Deleting shards87 if bytes_per_s/(60*1024) < byte_lower * (n_open_shards-1) and records_per_s/60 < record_upper * (n_open_shards-1):88 deletion_triger = deletion_triger + 189 90 if deletion_triger == mins_before_deletion:91 kinesis.update_shard_count(92 StreamName=stream_name,93 TargetShardCount=n_open_shards - 1,94 ScalingType='UNIFORM_SCALING'95 )96 deletion_triger = 097 98 else:99 print('Monitor stand by...')100 ...
kinesis_client_mocker.py
Source:kinesis_client_mocker.py
...17 return_value={18 "StreamDescriptionSummary": {"OpenShardCount": open_shard_count}19 },20 )21 def update_shard_count(22 self,23 stream_name: str,24 current_shard_count: int,25 target_shard_count: int,26 ) -> MockerFixture:27 return self.mocker.patch.object(28 self.client,29 "update_shard_count",30 return_value={31 "StreamName": stream_name,32 "CurrentShardCount": current_shard_count,33 "TargetShardCount": target_shard_count,34 },35 )
twitterReshardStream.py
Source:twitterReshardStream.py
1import boto32def update_shard_count(streamName, shardCount, scalingType):3 kinesis = boto3.client('kinesis')4 print streamName + '\n' 5 print shardCount 6 print '\n' + scalingType + '\n'7 response = kinesis.update_shard_count(8 StreamName = streamName,9 TargetShardCount = shardCount,10 ScalingType = scalingType...
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!!