preset: allow to sleep before putting objects #73
2 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,7 @@ import json
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import time
|
||||||
|
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from concurrent.futures import ProcessPoolExecutor
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
@ -32,6 +33,8 @@ parser.add_argument('--endpoint', help='Node address')
|
||||||
parser.add_argument('--update', help='Save existed containers')
|
parser.add_argument('--update', help='Save existed containers')
|
||||||
parser.add_argument('--ignore-errors', help='Ignore preset errors')
|
parser.add_argument('--ignore-errors', help='Ignore preset errors')
|
||||||
parser.add_argument('--workers', help='Count of workers in preset. Max = 50, Default = 50', default=50)
|
parser.add_argument('--workers', help='Count of workers in preset. Max = 50, Default = 50', default=50)
|
||||||
|
parser.add_argument('--sleep', help='Time to sleep between container creation and object PUT (in seconds), '
|
||||||
|
'Default = 8', default=8)
|
||||||
|
|
||||||
args: Namespace = parser.parse_args()
|
args: Namespace = parser.parse_args()
|
||||||
print(args)
|
print(args)
|
||||||
|
@ -74,6 +77,10 @@ def main():
|
||||||
if not ignore_errors:
|
if not ignore_errors:
|
||||||
sys.exit(ERROR_WRONG_CONTAINERS_COUNT)
|
sys.exit(ERROR_WRONG_CONTAINERS_COUNT)
|
||||||
|
|
||||||
|
if args.sleep != 0:
|
||||||
|
print(f"Sleep for {args.sleep} seconds")
|
||||||
|
time.sleep(args.sleep)
|
||||||
|
|
||||||
print(f"Upload objects to each container: {args.preload_obj} ")
|
print(f"Upload objects to each container: {args.preload_obj} ")
|
||||||
payload_file = tempfile.NamedTemporaryFile()
|
payload_file = tempfile.NamedTemporaryFile()
|
||||||
random_payload(payload_file, args.size)
|
random_payload(payload_file, args.size)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import argparse
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import time
|
||||||
from concurrent.futures import ProcessPoolExecutor
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
|
||||||
from helpers.cmd import random_payload
|
from helpers.cmd import random_payload
|
||||||
|
@ -22,6 +23,8 @@ parser.add_argument('--location', help='AWS location. Will be empty, if has not
|
||||||
parser.add_argument('--versioning', help='True/False, False by default.')
|
parser.add_argument('--versioning', help='True/False, False by default.')
|
||||||
parser.add_argument('--ignore-errors', help='Ignore preset errors')
|
parser.add_argument('--ignore-errors', help='Ignore preset errors')
|
||||||
parser.add_argument('--workers', help='Count of workers in preset. Max = 50, Default = 50', default=50)
|
parser.add_argument('--workers', help='Count of workers in preset. Max = 50, Default = 50', default=50)
|
||||||
|
parser.add_argument('--sleep', help='Time to sleep between container creation and object PUT (in seconds), '
|
||||||
|
'Default = 8', default=8)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
print(args)
|
print(args)
|
||||||
|
@ -65,6 +68,10 @@ def main():
|
||||||
if not ignore_errors:
|
if not ignore_errors:
|
||||||
sys.exit(ERROR_WRONG_CONTAINERS_COUNT)
|
sys.exit(ERROR_WRONG_CONTAINERS_COUNT)
|
||||||
|
|
||||||
|
if args.sleep != 0:
|
||||||
|
print(f"Sleep for {args.sleep} seconds")
|
||||||
|
time.sleep(args.sleep)
|
||||||
|
|
||||||
print(f"Upload objects to each bucket: {objects_per_bucket} ")
|
print(f"Upload objects to each bucket: {objects_per_bucket} ")
|
||||||
payload_file = tempfile.NamedTemporaryFile()
|
payload_file = tempfile.NamedTemporaryFile()
|
||||||
random_payload(payload_file, args.size)
|
random_payload(payload_file, args.size)
|
||||||
|
|
Loading…
Reference in a new issue