forked from firefoxbug/OpenCDN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ae5e9d
commit b21bcf3
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: UTF-8 -*- | ||
|
||
# author : firefoxbug | ||
# E-Mail : wanghuafire@gmail.com | ||
# Blog : www.firefoxbug.com | ||
|
||
"""Test for opencdn queue | ||
produce task and put task into gearman server | ||
""" | ||
import sys | ||
import os | ||
parent, bindir = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0]))) | ||
if os.path.exists(os.path.join(parent, 'lib')): | ||
sys.path.insert(0, os.path.join(parent, 'lib')) | ||
|
||
from ocdn_queue import Producer | ||
|
||
class ProducerTest(Producer): | ||
"""docstring for queue_test""" | ||
def __init__(self, queue_ip='103.6.222.21', queue_port=4730): | ||
super(ProducerTest, self).__init__(queue_ip, queue_port) | ||
self.task_name = 'ProducerTest' | ||
|
||
def produce_job_loop(self): | ||
self.producer_connect_queue() | ||
job2do = {'id':'1', 'data':'hello'} | ||
self.put_task_into_queue('OCDNQUEUE', job2do, Background=False) | ||
|
||
if __name__ == '__main__': | ||
producer = ProducerTest() | ||
producer.produce_job_loop() |