当前位置: 首页>>代码示例>>Python>>正文


Python uwsgi.spool函数代码示例

本文整理汇总了Python中uwsgi.spool函数的典型用法代码示例。如果您正苦于以下问题:Python spool函数的具体用法?Python spool怎么用?Python spool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了spool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

	def setUp(self):
		self.addCleanup(cleanTasks)
		for priority, name in constants.tasks:
			task = {'name': name, 'at': int(time.time() + 10)}
			if priority is not None:
				task['priority'] = str(priority)
			uwsgi.spool(task)
开发者ID:vine,项目名称:uwsgi,代码行数:7,代码来源:spooler.py

示例2: notify

    def notify(self, thread, comment):

        body = self.format(thread, comment)

        if uwsgi:
            uwsgi.spool({b"subject": thread["title"].encode("utf-8"), b"body": body.encode("utf-8")})
        else:
            start_new_thread(self._retry, (thread["title"], body))
开发者ID:o2ee,项目名称:isso,代码行数:8,代码来源:notifications.py

示例3: sendmail

 def sendmail(self, subject, body, thread, comment, to=None):
     to = to or self.conf.get("to")
     if uwsgi:
         uwsgi.spool({b"subject": subject.encode("utf-8"),
                      b"body": body.encode("utf-8"),
                      b"to": to.encode("utf-8")})
     else:
         start_new_thread(self._retry, (subject, body, to))
开发者ID:posativ,项目名称:isso,代码行数:8,代码来源:notifications.py

示例4: start_processing

    def start_processing(cls, att):
        try:
            import uwsgi

            uwsgi.spool({b"processor": cls.__name__.encode(), b"id": str(att.id).encode()})
        except Exception as exc:
            print("Not running in uWSGI env. Executing in foreground: {}".format(exc))
            proc = cls(att)
            return proc.process()
开发者ID:vladimiroff,项目名称:humble-media,代码行数:9,代码来源:processing.py

示例5: delay

 def delay(cls, *args, **kwargs):
     id = str(uuid.uuid4())
     kwargs['language'] = translation.get_language()
     import uwsgi
     uwsgi.spool({
         'task': pickle.dumps(cls(id)),
         'args': pickle.dumps(args),
         'kwargs': pickle.dumps(kwargs),
     })
     return TaskStatus(id)
开发者ID:allenta,项目名称:vac-templater,代码行数:10,代码来源:base.py

示例6: monitor_changes

def monitor_changes(db):
    previous_seq = 0
    count = 0
    while True:
        stream = ChangesStream(db, feed="continuous",
                               heartbeat=True, since=previous_seq)
        log.debug("pull from changes")
        for c in stream:
            previous_seq = c['seq']
            count += 1
            if count % 100 == 0:
                log.debug("updating views")
                try:
                    uwsgi.spool({"action": _UPDATE_VIEW, "uri": db.uri})
                except:
                    pass
开发者ID:adlnet,项目名称:LR-Lite,代码行数:16,代码来源:__init__.py

示例7: __call__

 def __call__(self, *args, **kwargs):
     arguments = self.base_dict
     if len(args) > 0:
         arguments.update(args[0])
     if kwargs:
         arguments.update(kwargs)
     return uwsgi.spool(arguments)
开发者ID:fijal,项目名称:uwsgi,代码行数:7,代码来源:uwsgidecorators.py

示例8: spool

 def spool(self, *args, **kwargs):
     arguments = self.base_dict
     arguments["ud_spool_ret"] = str(uwsgi.SPOOL_RETRY)
     if len(args) > 0:
         arguments.update(args[0])
     if kwargs:
         arguments.update(kwargs)
     return uwsgi.spool(arguments)
开发者ID:sashka,项目名称:uwsgi,代码行数:8,代码来源:uwsgidecorators.py

示例9: application

def application(env, start_response):

    name = uwsgi.spool({'Hello':'World', 'I am a':'long running task'})
    print("spooled as %s" % name)

    start_response('200 Ok', [('Content-Type','text/plain'),('uWSGI-Status', 'spooled')])

    return "task spooled"
开发者ID:20tab,项目名称:uwsgi,代码行数:8,代码来源:spoolme.py

示例10: hello

def hello():
    try:
        # NOTE: simulate a failure.
        if randint(1, 5) == 1:
            raise Exception("this is the end")

        mkey = mclient.get("sleep")
        if mkey:
            return "Hello World from cache :: {} !".format(mkey)

       # NOTE: simulate a long operation.
        print("sleep my friend !")
        time.sleep(5)
        mclient.set("sleep", "Hearth of the Swarm")
        return "Hello World !"
    except Exception as e:
        uwsgi.spool({'name': 'Wings of liberty'})
        return "Hello World with failure !"
开发者ID:hfoffani,项目名称:ep16-training-uwsgi,代码行数:18,代码来源:server.py

示例11: __call__

 def __call__(self, *args, **kwargs):
     arguments = self.base_dict
     if not self.pass_arguments:
         if len(args) > 0:
             arguments.update(args[0])
         if kwargs:
             arguments.update(kwargs)
     else:
         spooler_args = {}
         for key in ('message_dict', 'spooler', 'priority', 'at', 'body'):
             if key in kwargs:
                 spooler_args.update({key: kwargs.pop(key)})
         arguments.update(spooler_args)
         arguments.update({'args': pickle.dumps(args), 'kwargs': pickle.dumps(kwargs)})
     return uwsgi.spool(arguments)
开发者ID:kerncai,项目名称:zeus,代码行数:15,代码来源:uwsgidecorators.py

示例12: mule

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""We need this mule because we can't uwsgi.spool in a greenlet.

To resolve this problem, we send a message from the greenlet to the mule (that
IS part of the uWSGI stack, not only having the context), that itself transmits
the message on the spool.
"""
import ast
import uwsgi

while True:
    message = uwsgi.mule_get_msg()
    if message:
        message = ast.literal_eval(message)
        uwsgi.spool(message)
开发者ID:numberly,项目名称:europython2014,代码行数:16,代码来源:mule.py

示例13: spooler_func

# uwsgi --master --plugins=python27 --spooler=/var/spool/uwsgi/ --spooler-import spooler_dir.py
import uwsgi


def spooler_func(env):
    print(uwsgi.spooler_dir())
    return uwsgi.SPOOL_RETRY

uwsgi.spooler = spooler_func
uwsgi.spool({"foo": "bar"})
开发者ID:unbit,项目名称:uwsgi,代码行数:10,代码来源:spooler_dir.py

示例14: notify

 def notify(self, subject, body, retries=5):
     uwsgi.spool({"subject": subject.encode('utf-8'), "body": body.encode('utf-8')})
开发者ID:morozd,项目名称:isso,代码行数:2,代码来源:core.py

示例15: producer

def producer():
    uwsgi.spool(ud_spool_func="consumer", dest=random.choice(projects))
    time.sleep(2)
开发者ID:grandynguyen,项目名称:uwsgi,代码行数:3,代码来源:read.py


注:本文中的uwsgi.spool函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。