Metadata-Version: 1.1
Name: Flask-Task-Monitor
Version: 2.0
Summary: Flask Task Monitor module
Home-page: http://github.com/nonetheless/Flask-Task-Monitor
Author: nonetheless
Author-email: UNKNOWN
License: MIT
Description: ==================
        Flask Task Monitor
        ==================
        A flask plugin to monitor thread task
        
        How to use
        ==========
        Install
        -------
        To install from source, download the source code, then run this:
        ::
        
            python setup.py install
        
        Or install with pip:
        ::
        
            pip install Flask-Task-Monitor
        
        Setup
        =====
        Adding the extension to your Flask app is simple:
        ::
        
            from flask import Flask
            from flask_monitor import Monitor
            monitor = Monitor(config={
                'FLASK_MONITOR_PERIOD': 1
            })
            app = Flask(__name__)
            monitor.init_app(app)
        
        Add monitered task with database
        ::
        
            from flask_monitor import DBMonitor
            from yourapplication import monitor
        
            class DemoMonitorJob(DBMonitor):
                def __init__(self, a, b, c):
                    super(DemoMonitorJob, self).__init__()
                    pass
        
                @classmethod
                def redo(cls, *args, **kwargs):
                    '''
                    execute when your job is crashed
                    '''
                    pass
        
                @classmethod
                def roll_back(cls, *args, **kwargs):
                    '''
                    execute after redo when catch exception
                    '''
                    pass
        
                def do(self, *args, **kwargs):
                    '''your own job which needs to monitered
                    '''
                    pass
        
            monitor.add_check_monitor(DemoMonitorJob)
        
        Your own monitor
        ================
        You can code your own monitor by redis, zookeeper, etcd and more
        ::
        
            from flask_monitor import BaseMonitorInterface
            class YourMonitor(BaseMonitorInterface):
                def lock(self, *args, **kwargs):
                    '''
                    when called your do function
                    '''
                    pass
        
                def unlock(self, args, **kwargs):
                    '''
                    when your do function return
                    '''
                    pass
        
                @classmethod
                def check(cls, *args, **kwargs):
                    '''
                    your own check function:            it will return to
                        try:
                            redo(list, dict)
                        except Expection:
                            rollback(list,dict)
                    '''
                    return list, dict
        
                @abstractmethod
                def do(self, *args, **kwargs):
                    pass
        
                @classmethod
                @abstractmethod
                def redo(self, *args, **kwargs):
                    pass
        
                @classmethod
                @abstractmethod
                def rollback(self, *args, **kwargs):
                    pass
        
        
Keywords: utility,versioning
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
