{ "info": { "author": "Justin Engel", "author_email": "jtengel08@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "========================\nPython Service Scheduler\n========================\n\nPython 3 service scheduler to run services at a desired interval. This library uses a long running process which can\nlisten for commands to change the schedule without restarting down the process.\n\n\nAPI\n===\n\nSchedule:\n---------\n\n * Properties\n - days (int)[0]: Number of days when the next run should happen.\n - hours (int)[0]: Number of hours when the next run should happen.\n - minutes (int)[0]: Number of minutes when the next run should happen.\n - seconds (int)[0]: Number of seconds when the next run should happen.\n - milliseconds (int)[0]: Number of milliseconds when the next run should happen.\n - microseconds (int)[0]: Number of microseconds when the next run should happen.\n - sundays (bool)[None]: Allow the schedule to run on sundays. If all weekdays are None allow all weekdays.\n - mondays (bool)[None]: Allow the schedule to run on mondays. If all weekdays are None allow all weekdays.\n - tuesdays (bool)[None]: Allow the schedule to run on tuesdays. If all weekdays are None allow all weekdays.\n - wednesdays (bool)[None]: Allow the schedule to run on wednesdays. If all weekdays are None allow all weekdays.\n - thursdays (bool)[None]: Allow the schedule to run on thursdays. If all weekdays are None allow all weekdays.\n - fridays (bool)[None]: Allow the schedule to run on fridays. If all weekdays are None allow all weekdays.\n - saturdays (bool)[None]: Allow the schedule to run on saturdays. If all weekdays are None allow all weekdays.\n - at (str)[None]: Time of day when the schedule should run.\n - start_on (str)[None]: Date and time on which to start on.\n - end_on (str)[None]: Date and time on which to end on.\n - callback (function)[None]: Function to call when run is called.\n * Methods\n - can_run(): Return True if it is time to run the schedule function.\n - run(callback=None): Run the callback function and create the next_run interval datetime.\n\n\nSubprocessService:\n------------------\n\n * Properties\n - cmd (str/list): String shell command which will be split by shlex or a list of command arguments.\n - output_log (str)[None]: Standard Output log file name.\n - error_log (str)[None]: Standard Error log file name.\n - shell (bool)[None]: If the subprocess should run a shell command.\n * Methods\n - __call__(): Run the main start function.\n - start(): Main run function.\n - stop(): Stop the main function.\n - is_running(): Return if this function is still running.\n\n\nServiceScheduler:\n-----------------\n\n * Properties\n - print_func (function)[None]: Custom print function that gets called every time a service is run.\n * Methods\n - print_func(name, service, schedule): Override this function. Print when service is run.\n\n\nCode Example\n============\n\nSchedule\n--------\n\n.. code-block:: python\n\n import pyservice_scheduler as pss\n\n def hello():\n print('hello')\n\n sched = pss.Schedule(callback=hello, seconds=5)\n\n while True:\n if sched.can_run():\n sched.run()\n time.sleep(1)\n\n\nService\n-------\n\n.. code-block:: python\n\n import pyservice_scheduler as pss\n\n service = pss.SubprocessService('ls')\n\n # Run the Service\n service()\n\n\nService Scheduler\n-----------------\n\n.. code-block:: python\n\n import time\n import pyservice_scheduler as pss\n\n # Create the service scheduler\n scheduler = pss.ServiceScheduler()\n\n # Register the service\n scheduler.register('ls', pss.Schedule(seconds=30), pss.SubprocessService('ls', output_log='ls.log', shell=True))\n\n while True:\n scheduler.run()\n time.sleep(1)\n\n\nCommand Line\n============\n\nSeveral command line options have been made in \"server.py\". This is to help create a general service schedule server\nto get started without much hassle.\n\nEnvironment Variables\n---------------------\n\nSetup the server using environment variables. Defaults are already set.\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler save_server_defaults --address \"0.0.0.0\" --port \"8000\"\n\n\nRun Server\n----------\n\nStart running the service scheduler with\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler run\n\n Alternatively run with a password\n\n $> python -m pyservice_scheduler run --authkey 'abc123'\n\n.. note::\n\n Keep using the authkey argument if your server is password protected.\n\n $> python -m pyservice_scheduler quit --authkey \"abc123\"\n\n\nRegister Service\n----------------\nRegister a service to run\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler register --name \"ls\" --cmd ls --shell --output_log 'ls.log' --seconds 30\n\n\nList Services\n-------------\n\nList the registered services\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler list\n Services:\n ls - Next Run: 2019-08-29 16:05:07.279050\n\n\nRemove Service\n--------------\n\nRemove a service\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler remove --name \"ls\"\n\n\nQuit the Server\n---------------\n\nQuit the service scheduler\n\n.. code-block:: bash\n\n $> python -m pyservice_scheduler quit", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/justengel/pyservice_scheduler/archive/v0.0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/justengel/pyservice_scheduler", "keywords": "Service Schedule Scheduler", "license": "Proprietary", "maintainer": "", "maintainer_email": "", "name": "pyservice-scheduler", "package_url": "https://pypi.org/project/pyservice-scheduler/", "platform": "any", "project_url": "https://pypi.org/project/pyservice-scheduler/", "project_urls": { "Download": "https://github.com/justengel/pyservice_scheduler/archive/v0.0.1.tar.gz", "Homepage": "https://github.com/justengel/pyservice_scheduler" }, "release_url": "https://pypi.org/project/pyservice-scheduler/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Python service scheduler. Run services on a set schedule. Add or modify schedules with IPC.", "version": "0.0.1" }, "last_serial": 5773412, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "f68a6af7cfe207ec62ee570498143e63", "sha256": "d21cac62bc976894b9ffbf3686710dd97b0949fa721eb8d61d1a6cc4cfa7c298" }, "downloads": -1, "filename": "pyservice_scheduler-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f68a6af7cfe207ec62ee570498143e63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18487, "upload_time": "2019-09-03T01:52:11", "url": "https://files.pythonhosted.org/packages/1d/b8/42330db318011c2f15829746750bda9570ab61f295648892087b1da88b9b/pyservice_scheduler-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f68a6af7cfe207ec62ee570498143e63", "sha256": "d21cac62bc976894b9ffbf3686710dd97b0949fa721eb8d61d1a6cc4cfa7c298" }, "downloads": -1, "filename": "pyservice_scheduler-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f68a6af7cfe207ec62ee570498143e63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18487, "upload_time": "2019-09-03T01:52:11", "url": "https://files.pythonhosted.org/packages/1d/b8/42330db318011c2f15829746750bda9570ab61f295648892087b1da88b9b/pyservice_scheduler-0.0.1.tar.gz" } ] }