%global _empty_manifest_terminate_build 0 Name: python-sanic-scheduler Version: 1.0.7 Release: 1 Summary: Running functions on a schedule for Sanic License: MIT License URL: https://github.com/asmodius/sanic-scheduler Source0: https://mirrors.nju.edu.cn/pypi/web/packages/21/6e/b31af4ff1375906a78b80b1ac170ff40d87ed6e353bf55b975c804948187/sanic-scheduler-1.0.7.tar.gz BuildArch: noarch %description # Sanic Scheduler Sanic Scheduler runs a functions on a schedule. ## Installation Automatic installation: ```bash $ pip install sanic-scheduler ``` Sanic Scheduler is listed in [PyPI](https://pypi.python.org/pypi/sanic-scheduler) and can be installed with pip or easy_install. Manual installation: ```bash $ git clone https://github.com/asmodius/sanic-scheduler.git $ cd sanic_scheduler $ python setup.py install ``` Sanic Scheduler source code is [hosted on GitHub](https://github.com/asmodius/sanic-scheduler) ## Usage ```python import asyncio from datetime import datetime, time, timedelta from sanic import Sanic from sanic_scheduler import SanicScheduler, task app = Sanic() scheduler = SanicScheduler(app) @task(timedelta(seconds=30)) def hello(app): """Runs the function every 30 seconds.""" print("Hello, {0}".format(app), datetime.now()) @task(timedelta(hours=1), time(hour=1, minute=30)) async def foo_bar(_): """Runs the function every 1 hours after 1:30.""" print("Foo", datetime.now()) await asyncio.sleep(1) print("Bar") @task(timedelta(minutes=2), timedelta(seconds=10)) def baz(_): """Runs the function every 2 minutes after 10 seconds.""" print("Baz", datetime.now()) @task(start=timedelta(seconds=10)) def another(_): """Run the function after 10 seconds once.""" print("another", datetime.now()) if __name__ == "__main__": app.run(host='127.0.0.1', port=5000, debug=True) ``` %package -n python3-sanic-scheduler Summary: Running functions on a schedule for Sanic Provides: python-sanic-scheduler BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-sanic-scheduler # Sanic Scheduler Sanic Scheduler runs a functions on a schedule. ## Installation Automatic installation: ```bash $ pip install sanic-scheduler ``` Sanic Scheduler is listed in [PyPI](https://pypi.python.org/pypi/sanic-scheduler) and can be installed with pip or easy_install. Manual installation: ```bash $ git clone https://github.com/asmodius/sanic-scheduler.git $ cd sanic_scheduler $ python setup.py install ``` Sanic Scheduler source code is [hosted on GitHub](https://github.com/asmodius/sanic-scheduler) ## Usage ```python import asyncio from datetime import datetime, time, timedelta from sanic import Sanic from sanic_scheduler import SanicScheduler, task app = Sanic() scheduler = SanicScheduler(app) @task(timedelta(seconds=30)) def hello(app): """Runs the function every 30 seconds.""" print("Hello, {0}".format(app), datetime.now()) @task(timedelta(hours=1), time(hour=1, minute=30)) async def foo_bar(_): """Runs the function every 1 hours after 1:30.""" print("Foo", datetime.now()) await asyncio.sleep(1) print("Bar") @task(timedelta(minutes=2), timedelta(seconds=10)) def baz(_): """Runs the function every 2 minutes after 10 seconds.""" print("Baz", datetime.now()) @task(start=timedelta(seconds=10)) def another(_): """Run the function after 10 seconds once.""" print("another", datetime.now()) if __name__ == "__main__": app.run(host='127.0.0.1', port=5000, debug=True) ``` %package help Summary: Development documents and examples for sanic-scheduler Provides: python3-sanic-scheduler-doc %description help # Sanic Scheduler Sanic Scheduler runs a functions on a schedule. ## Installation Automatic installation: ```bash $ pip install sanic-scheduler ``` Sanic Scheduler is listed in [PyPI](https://pypi.python.org/pypi/sanic-scheduler) and can be installed with pip or easy_install. Manual installation: ```bash $ git clone https://github.com/asmodius/sanic-scheduler.git $ cd sanic_scheduler $ python setup.py install ``` Sanic Scheduler source code is [hosted on GitHub](https://github.com/asmodius/sanic-scheduler) ## Usage ```python import asyncio from datetime import datetime, time, timedelta from sanic import Sanic from sanic_scheduler import SanicScheduler, task app = Sanic() scheduler = SanicScheduler(app) @task(timedelta(seconds=30)) def hello(app): """Runs the function every 30 seconds.""" print("Hello, {0}".format(app), datetime.now()) @task(timedelta(hours=1), time(hour=1, minute=30)) async def foo_bar(_): """Runs the function every 1 hours after 1:30.""" print("Foo", datetime.now()) await asyncio.sleep(1) print("Bar") @task(timedelta(minutes=2), timedelta(seconds=10)) def baz(_): """Runs the function every 2 minutes after 10 seconds.""" print("Baz", datetime.now()) @task(start=timedelta(seconds=10)) def another(_): """Run the function after 10 seconds once.""" print("another", datetime.now()) if __name__ == "__main__": app.run(host='127.0.0.1', port=5000, debug=True) ``` %prep %autosetup -n sanic-scheduler-1.0.7 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-sanic-scheduler -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu May 18 2023 Python_Bot - 1.0.7-1 - Package Spec generated