• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python uwsgi.spool函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setUp

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


示例17: execute_async

 def execute_async(self):
     return uwsgi.spool(self.get_message_content())
开发者ID:codekoala,项目名称:uwsgi_tasks,代码行数:2,代码来源:tasks.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python uwsgi.websocket_handshake函数代码示例发布时间:2022-05-26
下一篇:
Python uwsgi.reload函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap