daemon-application


Namedaemon-application JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/zencore-cn/zencore-issues
SummaryDaemon application help functions.
upload_time2020-11-22 03:39:15
maintainer
docs_urlNone
authorzencore
requires_python
licenseMIT
keywords daemon-application
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # daemon-application

Daemon application help functions.


## Install

```
pip install daemon-application
```

## Usage

**Example for raw apis**
```
import time
import threading
import signal
from daemon_application import daemon_start

stopflag = False

def main():
    def on_exit(*args, **kwargs):
        with open("backgroud.log", "a", encoding="utf-8") as fobj:
            print("process got exit signal...", file=fobj)
            print(args, file=fobj)
            print(kwargs, file=fobj)
        global stopflag
        stopflag = True
    signal.signal(signal.SIGTERM, on_exit)
    signal.signal(signal.SIGINT, on_exit)
    while not stopflag:
        time.sleep(1)
        print(time.time())

if __name__ == "__main__":
    print("start background application...")
    daemon_start(main, "background.pid", True)
```

**Example for DaemonApplication**

```
import time
from daemon_application import DaemonApplication

class HelloApplication(DaemonApplication):
    def main(self):
        while True:
            print("hello")
            time.sleep(1)

controller = HelloApplication().get_controller()

if __name__ == "__main__":
    controller()

```

## Release

### v0.3.3 2020/11/22

- Fix show-config-filepaths.

### v0.3.2 2020/11/22

- Add click deps in requirements.txt

### v0.3.1 2020/11/22

- Add DaemonApplication.

### v0.3.0 2020/11/21

- New wrapper.

### v0.2.1 2018/04/18

- Old releases.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zencore-cn/zencore-issues",
    "name": "daemon-application",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "daemon-application",
    "author": "zencore",
    "author_email": "dobetter@zencore.cn",
    "download_url": "https://files.pythonhosted.org/packages/dd/65/5493880e3c577010684eaebde3bde9927f8f97cc0f2443531e5f5bef72b1/daemon-application-0.3.3.tar.gz",
    "platform": "",
    "description": "# daemon-application\n\nDaemon application help functions.\n\n\n## Install\n\n```\npip install daemon-application\n```\n\n## Usage\n\n**Example for raw apis**\n```\nimport time\nimport threading\nimport signal\nfrom daemon_application import daemon_start\n\nstopflag = False\n\ndef main():\n    def on_exit(*args, **kwargs):\n        with open(\"backgroud.log\", \"a\", encoding=\"utf-8\") as fobj:\n            print(\"process got exit signal...\", file=fobj)\n            print(args, file=fobj)\n            print(kwargs, file=fobj)\n        global stopflag\n        stopflag = True\n    signal.signal(signal.SIGTERM, on_exit)\n    signal.signal(signal.SIGINT, on_exit)\n    while not stopflag:\n        time.sleep(1)\n        print(time.time())\n\nif __name__ == \"__main__\":\n    print(\"start background application...\")\n    daemon_start(main, \"background.pid\", True)\n```\n\n**Example for DaemonApplication**\n\n```\nimport time\nfrom daemon_application import DaemonApplication\n\nclass HelloApplication(DaemonApplication):\n    def main(self):\n        while True:\n            print(\"hello\")\n            time.sleep(1)\n\ncontroller = HelloApplication().get_controller()\n\nif __name__ == \"__main__\":\n    controller()\n\n```\n\n## Release\n\n### v0.3.3 2020/11/22\n\n- Fix show-config-filepaths.\n\n### v0.3.2 2020/11/22\n\n- Add click deps in requirements.txt\n\n### v0.3.1 2020/11/22\n\n- Add DaemonApplication.\n\n### v0.3.0 2020/11/21\n\n- New wrapper.\n\n### v0.2.1 2018/04/18\n\n- Old releases.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Daemon application help functions.",
    "version": "0.3.3",
    "split_keywords": [
        "daemon-application"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "ef41f552107fc9b9e8d31cd2579ef36a",
                "sha256": "69293c75f4ab78ed9e2c3b177369be4cf9b7e41761e5e238a3f240ee9aba95b2"
            },
            "downloads": -1,
            "filename": "daemon-application-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ef41f552107fc9b9e8d31cd2579ef36a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5608,
            "upload_time": "2020-11-22T03:39:15",
            "upload_time_iso_8601": "2020-11-22T03:39:15.783448Z",
            "url": "https://files.pythonhosted.org/packages/dd/65/5493880e3c577010684eaebde3bde9927f8f97cc0f2443531e5f5bef72b1/daemon-application-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-22 03:39:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "zencore-cn",
    "error": "Could not fetch GitHub repository",
    "lcname": "daemon-application"
}
        
Elapsed time: 0.18668s