This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* @ignore | |
*/ | |
class OAuthException extends Exception { | |
// pass | |
} | |
class Oauth2_lib { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Genetic Algorithmn Implementation | |
""" | |
#引入随机函数 | |
import random | |
#定义基因遗传算法顶层接口 | |
class GeneticAlgorithm(object): | |
# 定义算法初始化 | |
def __init__(self, genetics): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from celery import Celery | |
app = Celery('test_celery',broker='amqp://admin:[email protected]:5672',backend='rpc://',include=['test_celery.tasks']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .tasks import longtime_add | |
import time | |
if __name__ == '__main__': | |
for _ in xrange(10): | |
result = longtime_add.delay(1,2) | |
print 'Task finished?',result.ready() | |
print 'Task result:',result.result | |
time.sleep(1) | |
print 'Task finished"',result.ready() | |
print 'Task result:',result.result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from test_celery.celery import app | |
import time | |
@app.task | |
def longtime_add(x,y): | |
print 'long time task begins' | |
time.sleep(5) | |
print 'long time task finished' | |
return x + y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from test_celery.celery import app | |
import time | |
@app.task | |
def longtime_add(x,y): | |
print 'long time task begins' | |
time.sleep(5) | |
print 'long time task finished' | |
return x + y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
rabbit: | |
hostname: rabbit | |
image: rabbitmq:latest | |
environment: | |
- RABBITMQ_DEFAULT_USER=admin | |
- RABBITMQ_DEFAULT_PASS=mypass | |
ports: | |
- "5672:5672" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:2.7 | |
ADD requirements.txt /app/requirements.txt | |
ADD ./test_celery/ /app/ | |
WORKDIR /app/ | |
RUN pip install -r requirements.txt | |
ENTRYPOINT celery -A test_celery worker --loglevel=info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
celery==4.0.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-cluster-with-celery-and-rabbitmq | |
-- test_celery | |
-- __init__.py | |
-- celery.py | |
-- tasks.py | |
-- run_tasks.py | |
-- docker-compose.yml | |
-- dockerfile | |
-- requirements.txt |
OlderNewer