{"id":26821191,"url":"https://github.com/realkinetic/tornado-shutdown","last_synced_at":"2025-03-30T07:19:02.313Z","repository":{"id":57476631,"uuid":"103846364","full_name":"RealKinetic/tornado-shutdown","owner":"RealKinetic","description":"Utility library to help graceful shutdown of Tornado processes","archived":false,"fork":false,"pushed_at":"2017-09-17T17:11:09.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T12:06:10.540Z","etag":null,"topics":["python","shutdown","tornado"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RealKinetic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-17T17:04:53.000Z","updated_at":"2021-03-09T03:18:32.000Z","dependencies_parsed_at":"2022-09-12T14:50:35.153Z","dependency_job_id":null,"html_url":"https://github.com/RealKinetic/tornado-shutdown","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Ftornado-shutdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Ftornado-shutdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Ftornado-shutdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Ftornado-shutdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealKinetic","download_url":"https://codeload.github.com/RealKinetic/tornado-shutdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246286111,"owners_count":20753018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","shutdown","tornado"],"created_at":"2025-03-30T07:19:01.756Z","updated_at":"2025-03-30T07:19:02.307Z","avatar_url":"https://github.com/RealKinetic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tornado-shutdown\n\nGracefully handling shutdown for server processes can be complicated. This\nmodule attempts simplify things by handling SIGINT and SIGTERM for you. All you\nneed to do is add callbacks that are run when those signals are fired.\n\nAn example::\n    from tornado import web\n    from tornado import ioloop\n\n    import tornado_shutdown as shutdown\n\n\n    class MainHandler(web.RequestHandler):\n        def get(self):\n            self.write(\"Hello, world\")\n\n\n    application = web.Application([\n        (r\"/\", MainHandler),\n    ])\n\n    if __name__ == '__main__':\n        shutdown.install_handlers()\n\n        server = application.listen(8888)\n\n        shutdown.at_shutdown(server.stop)\n\n        ioloop.start()\n\nRun the above code and then issue a kill command in a separate terminal. E.g.:\n\n    ``kill -2 PROCESS_ID`` or ``kill -15 PROCESS_ID``\n\nThis module is meant to be used as a singleton. In order to control the\nshutdown deadline, ``TORNADO_SHUTDOWN_DEADLINE`` as an environment variable is\nrespected.\n\n## Testing\n\nRun ``python -m tornado_shutdown``\n\nWill run an http server on 8888. Kill the process with ``kill -2`` or ``kill\n-15`` and done. :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealkinetic%2Ftornado-shutdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealkinetic%2Ftornado-shutdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealkinetic%2Ftornado-shutdown/lists"}