Start the worker:
celery -A tasks worker --loglevel=info -c 2 --pidfile=celery.pid
In another terminal send 6 tasks:
python script.py
"""SocksiPy - Python SOCKS module. | |
Version 1.00 | |
Copyright 2006 Dan-Haim. All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, | |
are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
from gevent import monkey; monkey.patch_all() | |
import gevent | |
import gevent.greenlet | |
from functools import partial | |
from random import random | |
import urllib | |
import urllib2 | |
def on_exception(fun, greenlet): |
''' quick example showing how to attach a pdf to multipart messages | |
and then send them from SES via boto | |
''' | |
from email.mime.text import MIMEText | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
import boto |
# Metaprogramming/Singleton.py | |
class Singleton(type): | |
instance = None | |
def __call__(cls, *args, **kw): | |
if not cls.instance: | |
cls.instance = super(Singleton, cls).__call__(*args, **kw) | |
return cls.instance | |
class ASingleton(object): |
""" usage: | |
a4.py train TRAIN_FEATURE_FILE [--new] [--validate] | |
a4.py classify MUSIC_FEATURE_FILE | |
The files should be CSV with 6 columns, the last of which is the target/label/class (or empty, if classifying), and the first of which is ignored. | |
""" | |
#------------------------------------------------------------------------------- | |
# Name: Pat Kujawa | |
# Purpose: MM audio classification asn 4 | |
#------------------------------------------------------------------------------- |
# This file is just Python, with a touch of Django which means you | |
# you can inherit and tweak settings to your hearts content. | |
from sentry.conf.server import * | |
import os.path | |
CONF_ROOT = os.path.dirname(__file__) | |
DATABASES = { | |
'default': { | |
# You can swap out the engine for MySQL easily by changing this value |
from celery_app import Celery | |
celery = Celery("tasks", backend="amqp", broker="amqp://guest@localhost") | |
@celery.task(name='test_task') | |
def test_task(): | |
return "boom!" |
function scroll_to(splash, x, y) | |
local js = string.format( | |
"window.scrollTo(%s, %s);", | |
tonumber(x), | |
tonumber(y) | |
) | |
return splash:runjs(js) | |
end |
# !/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
__author__ = 'Diego Garcia' | |
import tornado.web | |
import tornado.ioloop | |
import oauth2.tokengenerator | |
import oauth2.grant | |
import oauth2.store.redisdb | |
import oauth2.store.mongodb |