From 21bfa50f775e6d128778b077d1a3fda91880448f Mon Sep 17 00:00:00 2001 From: Uladzislau Muraveika Date: Fri, 16 Aug 2024 16:04:30 +0300 Subject: [PATCH] feat(snapshot) - add possibillity to run snapshot script for non-beacon chains --- tools/snapshot/snapshot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/snapshot/snapshot.py b/tools/snapshot/snapshot.py index 87fe9a9..c4229fb 100644 --- a/tools/snapshot/snapshot.py +++ b/tools/snapshot/snapshot.py @@ -444,10 +444,16 @@ def snapshot(do_bucket_sync=False): snapshot a network. """ log.debug('started snapshot') - beacon_machine = list(filter(lambda e: e['shard'] == beacon_chain_shard, machines))[0] + beacon_machines = list(filter(lambda e: e['shard'] == beacon_chain_shard, machines)) + if not beacon_machines: + log.debug('there is no beacon machines, continue for the rest') + bucket_rsync_threads = [] + else: + beacon_machine = beacon_machines[0] + # snapshot beacon chain first + bucket_rsync_threads = [_snapshot(beacon_machine, do_bucket_sync)] aux_machines = filter(lambda e: e['shard'] != beacon_chain_shard, machines) threads, pool = [], ThreadPool() - bucket_rsync_threads = [_snapshot(beacon_machine, do_bucket_sync)] # snapshot beacon chain first... for machine in aux_machines: threads.append(pool.apply_async(_snapshot, (machine, do_bucket_sync))) for t in threads: