From 38b1353f42454905b0bc1b1e79e510a7df9db1cf Mon Sep 17 00:00:00 2001 From: Eklavya Sharma Date: Mon, 18 Jul 2016 18:54:41 +0530 Subject: [PATCH] tools/run-dev.py: Clear memcached. Clear memcached when tools/run-dev.py is run. This prevents errors on using a different python version because values are pickled before being stored in memcached and different python versions implement pickling differently. Also provide a command-line option --no-clear-mc to prevent memcached from being cleared. --- tools/run-dev.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/run-dev.py b/tools/run-dev.py index 81eef15b54..6085d934f6 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +from __future__ import print_function + import optparse import subprocess import signal @@ -43,6 +45,10 @@ parser.add_option('--interface', action='store', dest='interface', default='127.0.0.1', help='Set the IP or hostname for the proxy to listen on') +parser.add_option('--no-clear-memcached', + action='store_false', dest='clear_memcached', + default=True, help='Do not clear memcached') + (options, args) = parser.parse_args() base_port = 9991 @@ -67,6 +73,10 @@ os.chdir(os.path.join(os.path.dirname(__file__), '..')) # Clean up stale .pyc files etc. subprocess.check_call('./tools/clean-repo') +if options.clear_memcached: + print("Clearing memcached ...") + subprocess.check_call('./scripts/setup/flush-memcached') + # Set up a new process group, so that we can later kill run{server,tornado} # and all of the processes they spawn. os.setpgrp()