'전체 글'에 해당되는 글 96건

Revoking task

celery 2014. 11. 24. 18:50

task revoke를 한다음에 다시 scheduled task를 가져오면 이전에 revoke된것들이 포함되어있다. 알고보니 revoked가 따로 있음 -_-

아직 revoke된거를 제외한 나머지 task만 가져오는건 못찾음.. 일단 revoke 안된것만 가져오는건 두 배열을 비교하는 수 밖에..


from celery.task.control import inspect

from celery.task.control import revoke


i = inspect()

queues = i.scheduled()

queues_revoked = i.revoked()

keys = queues.keys()

all_tasks = []

revoked_tasks = []

tasks = []


if len(keys) > 0:

    all_tasks = queues[keys[0]]

    revoked_tasks = queues_revoked[keys[0]]


for task in all_tasks:

    if task['request']['id'] not in revoked_tasks:

        revoke(task['request']['id'], terminate=True) 


블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

예약 푸시

celery 2014. 11. 20. 15:58

Schduled push

http://docs.celeryproject.org/en/latest/reference/celery.app.task.html?highlight=apply_async#celery.app.task.Task.apply_async

apply_async eta 파라미터로 datetime object를 넘겨주면됨.

블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,

ubuntu t2.micro magnatic 8GB


$ sudo apt-get update

* LC_ALL 설정

/home/ubuntu/.bashrc 에 다음 추가

export LC_ALL="en_US.UTF-8"

* shell update

source .bash_profile



* mongoDB 설치

(http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/)


* mongoDB Setting

Now configure the following MongoDB parameters by editing the configuration file /etc/mongod.conf:

dbpath = /data
logpath = /log/mongod.log

* db path에 db폴더 만들고 권한 바꿔주기

$ sudo mkdir /data/db

$ sudo chown ubuntu /data/db


* 몽고 서비스 시작

$ sudo service mongod start


* For deployment

$ sudo apt-get install git

$ sudo apt-get install libxml2-dev libxslt1-dev python-dev

# $ sudo apt-get install python-pip

wget http://peak.telecommunity.com/dist/ez_setup.py

sudo python ez_setup.py

$ sudo easy_install requests==2.3.0

$ sudo easy_install -U pip


nginx

1
2
3
4
sudo aptitude install software-properties-common;
sudo add-apt-repository ppa:nginx/development;
sudo apt-get update;
sudo apt-get install nginx;

* 몇몇 mac과 별도로 설치한 module들

$ sudo pip install --no-use-wheel --upgrade distribute

$ sudo pip install cssselect

$ sudo apt-get install python-lxml

$ sudo pip install w3lib

$ sudo pip install tzlocal

$ sudo apt-get install nodejs (for javascript runtime)

$ sudo pip install futures


* server / job log file 생성

$ mkdir server/log

$ touch server/log/log.txt

$ touch server/log/job.txt

$sudo chown -R mongodb:mongodb /data /log /journal
* mongod 띄울때 기본적으로 localhost 만 붙을 수 있도록

bind_ip = 127.0.0.1

설정이 되어있다. remote에서 붙게 하려면 이걸 빼줄것!


'aws' 카테고리의 다른 글

kinesis firehose 삽질일기  (0) 2017.03.16
How to EC2 disk and memory usage monitoring  (0) 2015.03.27
elasticache dump to file  (1) 2015.03.23
HTTP 505: HTTP Version Not Supported  (0) 2014.07.09
boto s3 Broken pipe error  (0) 2014.04.25
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,