Skip to content

Instantly share code, notes, and snippets.

@tonywangcn
Last active March 19, 2017 09:36
Show Gist options
  • Save tonywangcn/2ba20c758db53cc4f23a3f548bf63dc3 to your computer and use it in GitHub Desktop.
Save tonywangcn/2ba20c758db53cc4f23a3f548bf63dc3 to your computer and use it in GitHub Desktop.
@parallel
def install():
cmd = "celery -A test_celery worker --app=test_celery.celeryapp:app --concurrency=10 --loglevel=debug"
run("apt-get install dtach && apt-get install -y python-pip && pip install celery && pip install requests && pip install pymongo")
with settings(warn_only=True):
runResult = run("mkdir -p /root/code/test_celery")
if runResult.return_code == 1:
print 'file exists'
put("./test_celery/celeryapp.py", "/root/code/test_celery")
put("./test_celery/run_tasks.py", "/root/code/test_celery")
put("./test_celery/tasks.py", "/root/code/test_celery")
put("./test_celery/ua.txt", "/root/code/test_celery")
put("./test_celery/__init__.py", "/root/code/test_celery")
with cd("/root/code"):
result = run("ls -l")
run('dtach -n `mktemp -u /tmp/%s.XXXX` %s' % ('dtach', cmd))
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment