Skip to content

Instantly share code, notes, and snippets.

@lovesh
Forked from mzk-vct/gen_up_cmd.py
Last active February 2, 2017 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovesh/56b947b051f55619f2885feb09354b47 to your computer and use it in GitHub Desktop.
Save lovesh/56b947b051f55619f2885feb09354b47 to your computer and use it in GitHub Desktop.
Script for creating schedule. Generates POOL_UPGRADE command that can be send useing CLI to cluster
# Script for creating schedule
# Generates POOL_UPGRADE command that can be send useing CLI to cluster
```from datetime import datetime, timedelta
from dateutil import tz
# Following two parameters need to modified for each upgrade.
UPGRADE_NAME = "upgrade-11"
UPGRADE_VERSION = "0.1"
tempalte = "send POOL_UPGRADE name={name} version={version} sha256={sha256} " \
"action={action} schedule={schedule} timeout={timeout}"\
now = datetime.utcnow().replace(tzinfo=tz.tzutc()) + timedelta(minutes=5)
nodeIds = [
"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv",
"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb",
"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya",
"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA"
]
schedule = dict((nodeId, str(now + (timedelta(minutes=5) * i)))
for i, nodeId in enumerate(nodeIds))
command = tempalte.format(name="upgrade-11",
version="0.1",
sha256="aad1242",
action="start",
schedule=schedule,
timeout=10)
print(command)
exit()```
@lovesh
Copy link
Author

lovesh commented Feb 2, 2017

This script assumes there are 4 nodes running created with script generate_sovrin_pool_transactions. Please note that you need to specify own upgrade version and name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment