#NEWLINE# def enqueue_s3_keys_for_upload( s3_bucket , prefix , from_folder , queue ) : #NEWLINE# #INDENT# '\n    En-queues S3 Keys to be uploaded.\n\n    :param s3_bucket:               Boto Bucket object that contains the keys to be uploaded to\n    :param prefix:                  The path to the S3 folder to be downloaded. Example: bucket_root/folder_1\n    :param from_folder:             The relative or absolute path to the folder you wish to upload from\n    :param queue:                   A ProcessKeyQueue instance to enqueue all the keys in\n    ' #NEWLINE# abs_from_folder_path = os . path . abspath ( from_folder ) #NEWLINE# for ( root , dirs , files ) in os . walk ( abs_from_folder_path ) : #NEWLINE# #INDENT# for single_file in files : #NEWLINE# #INDENT# abs_file_path = os . path . join ( root , single_file ) #NEWLINE# s3_key_name = abs_file_path . replace ( abs_from_folder_path , '' , 1 ) #NEWLINE# if ( ( not s3_key_name . startswith ( '/' ) ) and ( prefix != '' ) ) : #NEWLINE# #INDENT# s3_key_name = ( '/' + s3_key_name ) #NEWLINE# #UNINDENT# s3_key_name = ( prefix + s3_key_name ) #NEWLINE# key = Key ( s3_bucket ) #NEWLINE# key . key = s3_key_name #NEWLINE# while ( 100000 < queue . process_able_keys_queue . qsize ( ) ) : #NEWLINE# #INDENT# time . sleep ( 1 ) #NEWLINE# #UNINDENT# queue . enqueue_item ( key , abs_file_path ) #NEWLINE# #UNINDENT# #UNINDENT# logger . info ( 'Initial queuing has completed. {0} keys has been enqueued.' . format ( queue . enqueued_counter ) ) #NEWLINE# queue . queuing_stopped ( )