feat: Enable parallell contract transactions in bootstrap

This commit is contained in:
Louis Holbrook
2021-10-29 09:36:14 +00:00
parent 3cc909c936
commit 1882910a8e
29 changed files with 247 additions and 131 deletions

View File

@@ -65,7 +65,7 @@ args_override = {
'REDIS_DB': getattr(args, 'redis_db'),
'META_HOST': getattr(args, 'meta_host'),
'META_PORT': getattr(args, 'meta_port'),
'KEYSTORE_FILE_PATH': getattr(args, 'y')
'WALLET_KEY_FILE': getattr(args, 'y')
}
config.dict_override(args_override, 'cli flag')
config.censor('PASSWORD', 'DATABASE')

View File

@@ -72,7 +72,7 @@ config.censor('PASSWORD', 'DATABASE')
config.censor('PASSWORD', 'SSL')
logg.debug(f'config loaded from {args.c}:\n{config}')
dirs = initialize_dirs(args.import_dir, force_reset=args.f)
dirs = initialize_dirs(args.import_dir)
valid_service_codes = config.get('USSD_SERVICE_CODE').split(",")

View File

@@ -12,11 +12,13 @@ def initialize_dirs(user_dir, force_reset=False):
dirs['new'] = os.path.join(user_dir, 'new')
dirs['meta'] = os.path.join(user_dir, 'meta')
dirs['custom'] = os.path.join(user_dir, 'custom')
dirs['phone'] = os.path.join(user_dir, 'phone')
dirs['preferences'] = os.path.join(user_dir, 'preferences')
dirs['txs'] = os.path.join(user_dir, 'txs')
dirs['keyfile'] = os.path.join(user_dir, 'keystore')
dirs['custom_new'] = os.path.join(dirs['custom'], 'new')
dirs['custom_meta'] = os.path.join(dirs['custom'], 'meta')
dirs['phone_meta'] = os.path.join(dirs['phone'], 'meta')
dirs['preferences_meta'] = os.path.join(dirs['preferences'], 'meta')
dirs['preferences_new'] = os.path.join(dirs['preferences'], 'new')
@@ -37,6 +39,6 @@ def initialize_dirs(user_dir, force_reset=False):
for d in dirs.keys():
if d == 'old':
continue
os.makedirs(dirs[d])
os.makedirs(dirs[d], exist_ok=True)
return dirs

View File

@@ -1,2 +1,2 @@
[rpc]
provider =
provider = http://localhost:63545

View File

@@ -37,11 +37,11 @@ if [ "$INCLUDE_BALANCES" != "y" ]
then
echo -e "\033[;96mRunning worker without opening balance transactions\033[;96m"
TARGET_TX_COUNT=$NUMBER_OF_USERS
nohup python cic_ussd/import_balance.py -vv -c "$CONFIG" -p "$ETH_PROVIDER" -r "$CIC_REGISTRY_ADDRESS" --token-symbol "$TOKEN_SYMBOL" -y "$KEYSTORE_PATH" "$OUT_DIR" > nohup.out 2> nohup.err < /dev/null &
nohup python cic_ussd/import_balance.py -vv -c "$CONFIG" -p "$ETH_PROVIDER" -r "$CIC_REGISTRY_ADDRESS" --token-symbol "$TOKEN_SYMBOL" -y "$WALLET_KEY_FILE" "$OUT_DIR" > nohup.out 2> nohup.err < /dev/null &
else
echo -e "\033[;96mRunning worker with opening balance transactions\033[;96m"
TARGET_TX_COUNT=$((NUMBER_OF_USERS*2))
nohup python cic_ussd/import_balance.py -vv -c "$CONFIG" -p "$ETH_PROVIDER" -r "$CIC_REGISTRY_ADDRESS" --include-balances --token-symbol "$TOKEN_SYMBOL" -y "$KEYSTORE_PATH" "$OUT_DIR" &
nohup python cic_ussd/import_balance.py -vv -c "$CONFIG" -p "$ETH_PROVIDER" -r "$CIC_REGISTRY_ADDRESS" --include-balances --token-symbol "$TOKEN_SYMBOL" -y "$WALLET_KEY_FILE" "$OUT_DIR" &
fi
echo -e "\033[;96mTarget count set to ${TARGET_TX_COUNT}"