diff options
Diffstat (limited to 'python-robit.spec')
-rw-r--r-- | python-robit.spec | 339 |
1 files changed, 339 insertions, 0 deletions
diff --git a/python-robit.spec b/python-robit.spec new file mode 100644 index 0000000..ad4f4f6 --- /dev/null +++ b/python-robit.spec @@ -0,0 +1,339 @@ +%global _empty_manifest_terminate_build 0 +Name: python-robit +Version: 0.3.0.1 +Release: 1 +Summary: Service Worker Framework +License: MIT License +URL: https://github.com/stratusadv/robit +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/fd/67/347721752d859c12a5b8c11cd9d226a40403a8021877a5271f155e122056/robit-0.3.0.1.tar.gz +BuildArch: noarch + + +%description +# Robit + +- Lightweight (no installed dependencies) Service Worker Framework + +## Usage + +### Worker + +- Code below is provided in the examples/worker_example.py file of this project. + +```python +import random +from time import sleep + +from robit import Worker + +wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure') + +# To connect to an active monitor use monitor_address & monitor_key +# wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure', monitor_address='http://127.0.0.1:8200', monitor_key='Your-Own-Unique-Monitor-Key-That-Secure') + +def function_sleep_short(): + sleep(2) + +def function_sleep_long(): + sleep(6) + +wo.add_job('Sleep for Short Period', function_sleep_short, 'Sleeping') +wo.add_job('Longer Sleep Period Function', function_sleep_long, 'Sleeping') + +def function_random_fail_often(): + if 1 == random.randint(1,3): + division_by_zero = 5 / 0 + sleep(4) + +def function_random_fail_rare(): + if 1 == random.randint(1,30): + division_by_zero = 5 / 0 + sleep(4) + +wo.add_job('A Function that Fails Often', function_random_fail_often, 'Failing') +wo.add_job('Might Fail Some Times', function_random_fail_rare, 'Failing') + +def function_full_speed(): + for i in range(100000): + x = i * i + sleep(1) + +wo.add_job('Lower Delay Function', function_full_speed, 'Rapid Execution') + +if __name__ == '__main__': + wo.start() + +``` + +The server will start and host a web portal on default port 8000 locally for you to view what is going on. + +### Monitor + +- Code below is provided in the examples/monitor_example.py file of this project. + +```python +from robit import Monitor + +mo = Monitor('Robit Example Monitor', key='Your-Own-Unique-Monitor-Key-That-Secure') + +if __name__ == '__main__': + mo.start() +``` + +The server will start and host a web portal on default port 8200 locally for you to view what is going on. + +## Features + +### Threaded Groups + +- Execute your jobs in order and group them to have them on separate threads. + +### Monitoring + +- Webserver provide a super easy way to see what is going on and monitor health. + +## Other Libraries Used + +- Boostrap 5 (Responsive UI) +- Vue Petite (Better UX) + +A robot for your bits! (Pronounced "Row-Bit") + + + +%package -n python3-robit +Summary: Service Worker Framework +Provides: python-robit +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-robit +# Robit + +- Lightweight (no installed dependencies) Service Worker Framework + +## Usage + +### Worker + +- Code below is provided in the examples/worker_example.py file of this project. + +```python +import random +from time import sleep + +from robit import Worker + +wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure') + +# To connect to an active monitor use monitor_address & monitor_key +# wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure', monitor_address='http://127.0.0.1:8200', monitor_key='Your-Own-Unique-Monitor-Key-That-Secure') + +def function_sleep_short(): + sleep(2) + +def function_sleep_long(): + sleep(6) + +wo.add_job('Sleep for Short Period', function_sleep_short, 'Sleeping') +wo.add_job('Longer Sleep Period Function', function_sleep_long, 'Sleeping') + +def function_random_fail_often(): + if 1 == random.randint(1,3): + division_by_zero = 5 / 0 + sleep(4) + +def function_random_fail_rare(): + if 1 == random.randint(1,30): + division_by_zero = 5 / 0 + sleep(4) + +wo.add_job('A Function that Fails Often', function_random_fail_often, 'Failing') +wo.add_job('Might Fail Some Times', function_random_fail_rare, 'Failing') + +def function_full_speed(): + for i in range(100000): + x = i * i + sleep(1) + +wo.add_job('Lower Delay Function', function_full_speed, 'Rapid Execution') + +if __name__ == '__main__': + wo.start() + +``` + +The server will start and host a web portal on default port 8000 locally for you to view what is going on. + +### Monitor + +- Code below is provided in the examples/monitor_example.py file of this project. + +```python +from robit import Monitor + +mo = Monitor('Robit Example Monitor', key='Your-Own-Unique-Monitor-Key-That-Secure') + +if __name__ == '__main__': + mo.start() +``` + +The server will start and host a web portal on default port 8200 locally for you to view what is going on. + +## Features + +### Threaded Groups + +- Execute your jobs in order and group them to have them on separate threads. + +### Monitoring + +- Webserver provide a super easy way to see what is going on and monitor health. + +## Other Libraries Used + +- Boostrap 5 (Responsive UI) +- Vue Petite (Better UX) + +A robot for your bits! (Pronounced "Row-Bit") + + + +%package help +Summary: Development documents and examples for robit +Provides: python3-robit-doc +%description help +# Robit + +- Lightweight (no installed dependencies) Service Worker Framework + +## Usage + +### Worker + +- Code below is provided in the examples/worker_example.py file of this project. + +```python +import random +from time import sleep + +from robit import Worker + +wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure') + +# To connect to an active monitor use monitor_address & monitor_key +# wo = Worker('Robit Example Worker', key='Your-Own-Unique-Worker-Key-That-Secure', monitor_address='http://127.0.0.1:8200', monitor_key='Your-Own-Unique-Monitor-Key-That-Secure') + +def function_sleep_short(): + sleep(2) + +def function_sleep_long(): + sleep(6) + +wo.add_job('Sleep for Short Period', function_sleep_short, 'Sleeping') +wo.add_job('Longer Sleep Period Function', function_sleep_long, 'Sleeping') + +def function_random_fail_often(): + if 1 == random.randint(1,3): + division_by_zero = 5 / 0 + sleep(4) + +def function_random_fail_rare(): + if 1 == random.randint(1,30): + division_by_zero = 5 / 0 + sleep(4) + +wo.add_job('A Function that Fails Often', function_random_fail_often, 'Failing') +wo.add_job('Might Fail Some Times', function_random_fail_rare, 'Failing') + +def function_full_speed(): + for i in range(100000): + x = i * i + sleep(1) + +wo.add_job('Lower Delay Function', function_full_speed, 'Rapid Execution') + +if __name__ == '__main__': + wo.start() + +``` + +The server will start and host a web portal on default port 8000 locally for you to view what is going on. + +### Monitor + +- Code below is provided in the examples/monitor_example.py file of this project. + +```python +from robit import Monitor + +mo = Monitor('Robit Example Monitor', key='Your-Own-Unique-Monitor-Key-That-Secure') + +if __name__ == '__main__': + mo.start() +``` + +The server will start and host a web portal on default port 8200 locally for you to view what is going on. + +## Features + +### Threaded Groups + +- Execute your jobs in order and group them to have them on separate threads. + +### Monitoring + +- Webserver provide a super easy way to see what is going on and monitor health. + +## Other Libraries Used + +- Boostrap 5 (Responsive UI) +- Vue Petite (Better UX) + +A robot for your bits! (Pronounced "Row-Bit") + + + +%prep +%autosetup -n robit-0.3.0.1 + +%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-robit -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.0.1-1 +- Package Spec generated |