Skip to content

Commit 40e2950

Browse files
committed
update command fix for v0.7.1
1 parent 9571cda commit 40e2950

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

core/management/commands/update.py

+22-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from packaging import version
77
import pdb
88
import shutil
9+
import sys
910
import time
1011

1112
# django
@@ -36,7 +37,7 @@ class Command(BaseCommand):
3637

3738

3839
# python path
39-
PYTHON_PATH = '/usr/local/anaconda/envs/combine/bin'
40+
PYTHON_PATH = sys.executable.rstrip('python').rstrip('/')
4041

4142

4243
def add_arguments(self, parser):
@@ -110,10 +111,6 @@ def update(self, args, options):
110111
# install requirements as combine user
111112
os.system('%s/pip install -r requirements.txt' % (self.PYTHON_PATH))
112113

113-
# ensure redis version
114-
os.system('%s/pip uninstall redis -y' % (self.PYTHON_PATH))
115-
os.system('%s/pip install redis==2.10.6' % (self.PYTHON_PATH))
116-
117114
# collect django static
118115
os.system('%s/python manage.py collectstatic --noinput' % (self.PYTHON_PATH))
119116

@@ -202,6 +199,9 @@ class VersionUpdateHelper(object):
202199
Class to manage actions specific to version-to-version updates
203200
'''
204201

202+
# python path
203+
PYTHON_PATH = sys.executable.rstrip('python').rstrip('/')
204+
205205

206206
def __init__(self):
207207

@@ -210,6 +210,7 @@ def __init__(self):
210210
self.v0_4__set_job_baseline_combine_version,
211211
self.v0_4__update_transform_job_details,
212212
self.v0_4__set_job_current_combine_version,
213+
self.v0_7_1__fix_redis_version_mismatches
213214
]
214215

215216

@@ -321,10 +322,26 @@ def v0_4__update_transform_job_details(self):
321322
job.update_job_details({'transformation':trans_dict})
322323

323324

325+
def v0_7_1__fix_redis_version_mismatches(self):
326+
327+
'''
328+
Method to fix any redis version mismatches
329+
'''
324330

331+
if version.parse(settings.COMBINE_VERSION) == version.parse('v0.7'):
325332

333+
logger.debug('v0_7_1__fix_redis_version_mismatches: fixing redis versioning')
326334

335+
# ensure redis version
336+
os.system('%s/pip uninstall redis celery -y' % (self.PYTHON_PATH))
337+
os.system('%s/pip install redis==2.10.6 celery==4.3.0' % (self.PYTHON_PATH))
327338

339+
# restart celery background tasks
340+
# get supervisor handle
341+
sp = SupervisorRPCClient()
342+
# fire action
343+
results = sp.restart_process('celery')
344+
logger.debug(results)
328345

329346

330347

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ backports.shutil-get-terminal-size==1.0.0
44
blinker==1.4
55
boto3
66
bs4==0.0.1
7-
redis==2.10.6
8-
celery[redis]
7+
redis==3.2.1
8+
celery==4.3.0
99
certifi==2017.7.27.1
1010
chardet==3.0.4
1111
cloudpickle==0.4.0

0 commit comments

Comments
 (0)