The purpose of the application is to solve the problem of having a unique 'APScheduler' object for a multithreaded application. The project aims to easily implement a client-server architecture to control the scheduled processes. Another great advantage is that you can use the scheduler in distributed processes or servers.
Project description
The purpose of the application is to solve the problem of having a unique 'APScheduler' object for a multithreaded application. The project aims to easily implement a client-server architecture to control the scheduled processes. Another advantage is that you can use the scheduler in distributed processes or servers.
INSTALL
=======
::
$ pip install APSchedulerSocket
USAGE
=====
::
from apschedulersocket import schedulers
from datetime import datetime
def my_process():
print("Executing my process: Hello world!")
# Show the protocol messages
schedulers.DEBUG = True
# New SchedulerServer
scheduler = schedulers.SchedulerServer(daemon=False)
# Check if the server was not already started by another thread/process
if not scheduler.client.is_server_running():
scheduler.add_job(func=my_process,
id="my_process",
trigger='interval',
next_run_time=datetime.now(),
minutes=1)
# start the apscheduler and the server
print("Server started!")
scheduler.start()
print("Server state (1=running):",
scheduler.client.call(["BackgroundScheduler","state"]))
print("The next run time of my_process:",
scheduler.client.call(["my_process","next_run_time"]))
print("Pause the job:",
scheduler.client.call(["my_process","pause"]))
print("Next run time of paused my_process (None=paused):",
scheduler.client.call(["my_process","next_run_time"]))
print("Resume the job:",
scheduler.client.call(["my_process","resume"]))
print("Wrong message to server:",
scheduler.client.call(["Can you also cook?",]))
print("Shutdown!",
scheduler.client.call(["shutdown",]))
DEVELOP
=======
::
$ git clone https://github.com/rristow/APSchedulerSocket APSchedulerSocket
$ cd APSchedulerSocket
$ make
RUNNING TESTS
=============
::
$ make test
# TODO!Changelog
=========
0.1 (unreleased)
----------------
- Initial release.
[Rodrigo Ristow]
APSchedulerSocket Copyright (c) 2012, Rodrigo Ristow
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INSTALL
=======
::
$ pip install APSchedulerSocket
USAGE
=====
::
from apschedulersocket import schedulers
from datetime import datetime
def my_process():
print("Executing my process: Hello world!")
# Show the protocol messages
schedulers.DEBUG = True
# New SchedulerServer
scheduler = schedulers.SchedulerServer(daemon=False)
# Check if the server was not already started by another thread/process
if not scheduler.client.is_server_running():
scheduler.add_job(func=my_process,
id="my_process",
trigger='interval',
next_run_time=datetime.now(),
minutes=1)
# start the apscheduler and the server
print("Server started!")
scheduler.start()
print("Server state (1=running):",
scheduler.client.call(["BackgroundScheduler","state"]))
print("The next run time of my_process:",
scheduler.client.call(["my_process","next_run_time"]))
print("Pause the job:",
scheduler.client.call(["my_process","pause"]))
print("Next run time of paused my_process (None=paused):",
scheduler.client.call(["my_process","next_run_time"]))
print("Resume the job:",
scheduler.client.call(["my_process","resume"]))
print("Wrong message to server:",
scheduler.client.call(["Can you also cook?",]))
print("Shutdown!",
scheduler.client.call(["shutdown",]))
DEVELOP
=======
::
$ git clone https://github.com/rristow/APSchedulerSocket APSchedulerSocket
$ cd APSchedulerSocket
$ make
RUNNING TESTS
=============
::
$ make test
# TODO!Changelog
=========
0.1 (unreleased)
----------------
- Initial release.
[Rodrigo Ristow]
APSchedulerSocket Copyright (c) 2012, Rodrigo Ristow
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file APSchedulerSocket-0.4.2.tar.gz
.
File metadata
- Download URL: APSchedulerSocket-0.4.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cce3e818cc7c601a5e019b7eb66a2094b4b7f3622e3aa9e4eda6019c8e399e9 |
|
MD5 | 54594d74be5c91853f4c1e163d7d8a64 |
|
BLAKE2b-256 | 9208a13ea9a7e1823563d4f81e283e790f8bda14a2b03a268855b19ce39b2636 |
File details
Details for the file APSchedulerSocket-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: APSchedulerSocket-0.4.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0e672044004c93e8e6b4bd7611a59aa2d382c2feee1fd87781bca38a871a48a |
|
MD5 | 8802ce02cd18086411a5786e13507294 |
|
BLAKE2b-256 | df844443d004c22de7a40982a2fe2d6c5c7f0334a8f9cf365d728000595c8b88 |