Skip to content

Commit 9ef7852

Browse files
author
Matt George
committed
updating the package with scripts for the web
and worker interfaces. Also found that I hadn't updated the itty requirements
1 parent 5fa70d8 commit 9ef7852

File tree

6 files changed

+48
-4
lines changed

6 files changed

+48
-4
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
simplejson==2.0.9
2-
itty==0.6.1
2+
itty==0.6.2
33
redis==0.6.0
44
pystache==0.1.0

resweb/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from itty import *
23
from pyres import ResQ
34
from pyres.failure import Failure
@@ -68,4 +69,4 @@ def my_media(request, filename):
6869
#return Response(output, content_type=content_type(filename))
6970
#return static_file(request, filename=filename, root=my_root)
7071

71-
run_itty()
72+
#run_itty()

resweb/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import pystache
22
from pyres import ResQ
33
from pyres.worker import Worker as Wrkr
4+
import os
5+
TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'templates')
46
class ResWeb(pystache.View):
5-
template_path = 'templates'
7+
template_path = TEMPLATE_PATH
68
def __init__(self, host):
79
super(ResWeb, self).__init__()
810
self.resq = ResQ(host)

scripts/pyres_web

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
from resweb import server
3+
from itty import *
4+
def main():
5+
from optparse import OptionParser
6+
usage = "usage: %prog [options]"
7+
parser = OptionParser(usage)
8+
parser.add_option("--host",
9+
dest="host",
10+
default="localhost",
11+
metavar="HOST")
12+
parser.add_option("--port",
13+
dest="port",
14+
type="int",
15+
default=8080)
16+
(options,args) = parser.parse_args()
17+
run_itty(host=options.host, port=options.port)
18+
19+
if __name__ == "__main__":
20+
main()

scripts/pyres_worker

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
from pyres.worker import Worker
3+
def main():
4+
from optparse import OptionParser
5+
usage = "usage: %prog [options] arg1"
6+
parser = OptionParser(usage=usage)
7+
#parser.add_option("-q", dest="queue_list")
8+
parser.add_option("--host", dest="host", default="localhost")
9+
parser.add_option("--port",dest="port",type="int", default=6379)
10+
(options,args) = parser.parse_args()
11+
if len(args) != 1:
12+
parser.print_help()
13+
parser.error("Argument must be a comma seperated list of queues")
14+
queues = args[0].split(',')
15+
server = '%s:%s' % (options.host,options.port)
16+
Worker.run(queues, server)
17+
18+
if __name__ == "__main__":
19+
main()

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
author='Matt George',
77
author_email='[email protected]',
88
url='http://github.com/binarydud/pyres',
9-
packages=['pyres', 'resweb']
9+
packages=['pyres', 'resweb'],
10+
package_data={'resweb': ['templates/*.mustache','media/*']},
11+
scripts=['scripts/pyres_worker', 'scripts/pyres_web']
1012
)

0 commit comments

Comments
 (0)