From fc717dd27a3bedaaf296b79134b184d14d0f90fa Mon Sep 17 00:00:00 2001 From: zzpwelkin Date: Fri, 27 Dec 2013 14:03:08 +0800 Subject: [PATCH] add env --- env/OPENSHIFT_CELERY_BROKER_TRANS.erb | 1 + env/OPENSHIFT_CELERY_BROKER_URL.erb | 2 ++ env/OPENSHIFT_CELERY_RESULT_BACKEND.erb | 1 + template.git/.openshift/action_hooks/build | 1 + template.git/.openshift/action_hooks/deploy | 6 ++++++ template.git/.openshift/action_hooks/post-deploy | 1 + template.git/.openshift/action_hooks/post_deploy | 4 ++++ template.git/.openshift/action_hooks/pre-build | 1 + template.git/celerytks/__init__.py | 0 template.git/celerytks/tasks.py | 13 +++++++++++++ 10 files changed, 30 insertions(+) create mode 100644 env/OPENSHIFT_CELERY_BROKER_TRANS.erb create mode 100644 env/OPENSHIFT_CELERY_BROKER_URL.erb create mode 100644 env/OPENSHIFT_CELERY_RESULT_BACKEND.erb create mode 100644 template.git/.openshift/action_hooks/build create mode 100755 template.git/.openshift/action_hooks/deploy create mode 100644 template.git/.openshift/action_hooks/post-deploy create mode 100755 template.git/.openshift/action_hooks/post_deploy create mode 100644 template.git/.openshift/action_hooks/pre-build create mode 100644 template.git/celerytks/__init__.py create mode 100644 template.git/celerytks/tasks.py diff --git a/env/OPENSHIFT_CELERY_BROKER_TRANS.erb b/env/OPENSHIFT_CELERY_BROKER_TRANS.erb new file mode 100644 index 0000000..97ee1da --- /dev/null +++ b/env/OPENSHIFT_CELERY_BROKER_TRANS.erb @@ -0,0 +1 @@ +mongodb diff --git a/env/OPENSHIFT_CELERY_BROKER_URL.erb b/env/OPENSHIFT_CELERY_BROKER_URL.erb new file mode 100644 index 0000000..b1ae0ea --- /dev/null +++ b/env/OPENSHIFT_CELERY_BROKER_URL.erb @@ -0,0 +1,2 @@ +<%= ENV['OPENSHIFT_MONGODB_DB_URL'] %> + diff --git a/env/OPENSHIFT_CELERY_RESULT_BACKEND.erb b/env/OPENSHIFT_CELERY_RESULT_BACKEND.erb new file mode 100644 index 0000000..33ab847 --- /dev/null +++ b/env/OPENSHIFT_CELERY_RESULT_BACKEND.erb @@ -0,0 +1 @@ +<%= ENV['OPENSHIFT_MONGODB_DB_URL'] %> diff --git a/template.git/.openshift/action_hooks/build b/template.git/.openshift/action_hooks/build new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/template.git/.openshift/action_hooks/build @@ -0,0 +1 @@ + diff --git a/template.git/.openshift/action_hooks/deploy b/template.git/.openshift/action_hooks/deploy new file mode 100755 index 0000000..3875983 --- /dev/null +++ b/template.git/.openshift/action_hooks/deploy @@ -0,0 +1,6 @@ +#!/bin/bash +# This deploy hook gets executed after dependencies are resolved and the +# build hook has been run but before the application has been started back +# up again. This script gets executed directly, so it could be python, php, +# ruby, etc. + diff --git a/template.git/.openshift/action_hooks/post-deploy b/template.git/.openshift/action_hooks/post-deploy new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/template.git/.openshift/action_hooks/post-deploy @@ -0,0 +1 @@ + diff --git a/template.git/.openshift/action_hooks/post_deploy b/template.git/.openshift/action_hooks/post_deploy new file mode 100755 index 0000000..d38c5da --- /dev/null +++ b/template.git/.openshift/action_hooks/post_deploy @@ -0,0 +1,4 @@ +#!/bin/bash + +source $OPENSHIFT_HOMEDIR/python/virtenv/bin/activate +export PYTHONPATH=`echo $OPENSHIFT_REPO_DIR`:$PYTHONPATH diff --git a/template.git/.openshift/action_hooks/pre-build b/template.git/.openshift/action_hooks/pre-build new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/template.git/.openshift/action_hooks/pre-build @@ -0,0 +1 @@ + diff --git a/template.git/celerytks/__init__.py b/template.git/celerytks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/template.git/celerytks/tasks.py b/template.git/celerytks/tasks.py new file mode 100644 index 0000000..2041943 --- /dev/null +++ b/template.git/celerytks/tasks.py @@ -0,0 +1,13 @@ +import celery +app = celery.Celery() + +@app.task +def addtest(x, y): + return x + y + +@app.task +def run_spiders(name, **kwargs): + """ + @param name: spider name + """ + pass