attrs = { 'context': context, 'execute': execute, '__module__': func.__module__, '__doc__': func.__doc__ } attrs.update(settings) if not name: name = func.__name__ return type(name, (self.task_base, ), attrs) def monkeypatch(): """monkeypatch huey to add subprocess worker""" constants.WORKER_TYPES = ( 'subprocess', ) # WORKER_THREAD, WORKER_GREENLET, WORKER_PROCESS consumer.WORKER_TO_ENVIRONMENT['subprocess'] = consumer.ThreadEnvironment TaskWrapper.create_task = create_task if __name__ == '__main__': monkeypatch() # this import must be AFTER monkeypatch from huey.bin.huey_consumer import consumer_main # python consumer_subprocess.py demo_tasks.huey -k subprocess --disable_health_check --simple consumer_main()
# WAPT is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with WAPT. If not, see <http://www.gnu.org/licenses/>. # # ----------------------------------------------------------------------- from __future__ import absolute_import from waptserver.config import __version__ import os import platform import sys if platform.system() != 'Windows': import setproctitle setproctitle.setproctitle('wapttasks') try: wapt_root_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) except: wapt_root_dir = 'c:/tranquilit/wapt' from huey.bin import huey_consumer if __name__ == '__main__': huey_consumer.consumer_main()
# # WAPT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # WAPT is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with WAPT. If not, see <http://www.gnu.org/licenses/>. # # ----------------------------------------------------------------------- from __future__ import absolute_import from waptserver.config import __version__ import os import sys try: wapt_root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) except: wapt_root_dir = 'c:/tranquilit/wapt' from huey.bin import huey_consumer if __name__ == '__main__': huey_consumer.consumer_main()