event-scheduler


Nameevent-scheduler JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/phluentmed/event-scheduler
SummaryAlways-on event scheduler
upload_time2022-01-06 06:22:37
maintainer
docs_urlNone
authorDil Mchaina, Farhan Ahmed
requires_python>=3.6
license
keywords python event scheduler
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Event Scheduler
## Table of Contents
- [Overview](#overview)
- [Installing](#installing)
- [Documentation](#documentation)
- [Quick Start](#quick-start)
- [Example](#example)
- [Contact](#contact)

### Overview
The Event Scheduler uses an internal thread to allow the application to 
schedule events to occur either ASAP or at a specified time in the future.
Instead of blocking your application's main thread, you can concurrently run
some lightweight tasks. We took some inspiration for the API design from the
python library's [scheduler](https://docs.python.org/3/library/sched.html). Unlike
the native sched module, the Event Scheduler is always on and ready to accept
events. Event Scheduler is completely thread-safe too!


### Installing
You should already have pip installed if you're using python > 3.4. If you
don't, please visit this [link](https://pip.pypa.io/en/stable/installing/) to 
install it.

To install event scheduler, type the following command in the terminal:

`pip install event-scheduler`

To import the module, add the following lines in your Python file.

`from event_scheduler import EventScheduler`

To download directly visit [PyPi](https://pypi.org/project/event-scheduler/) or
the [GitHub repository](https://github.com/phluentmed/PythonEventScheduler).

## Documentation
Full documentation can be found [here](https://event-scheduler.readthedocs.io).
### Quick Start
`event_scheduler.start()`
> Enable the event scheduler to start taking events

`event_scheduler.stop(hard_stop=False)`
>Stop the event scheduler and its internal thread. Set `hard_stop` to `True`
>to stop the scheduler right away and discard all pending events. Set 
>`hard_stop` to `False` to wait for all events to finish executing at their
>scheduled times.

`event_scheduler.enter(delay, priority, action, arguments=(), kwargs={})`

>Schedule an event with a callable `action` to be executed after the `delay`.
>Events will be executed according to their `delay` and `priority` (lower 
>number = higher priority). `arguments` holds positional arguments and 
>`kwargs` hold keyword arguments for the action. Returns an event object which
>can be used to cancel the event.

`event_scheduler.cancel(event)`
>Cancel the event if it has not yet been executed.

`event_scheduler.cancel_recurring(event_id)`
>Cancel the recurring event and all future occurrences. 

```python
from event_scheduler import EventScheduler

event_scheduler = EventScheduler()
# Starts the scheduler
event_scheduler.start()
# Schedule an event that prints a message after 5 seconds
event_scheduler.enter(5, 0, print, ('5 seconds has passed since this event was entered!',))
# Schedule a recurring event that prints a message every 10 seconds
event_scheduler.enter_recurring(10, 0, print, ('10 second interval has passed!',))
```
Output:
\
`5 seconds has passed since this event was entered!`
\
`10 second interval has passed!`
\
`10 second interval has passed!`
\
`...`
 
### Example
Please refer
[here](https://github.com/phluentmed/event-scheduler/blob/master/example/transactions.py)
for the example. 

### Contact
Please email phluentmed@gmail.com or open an issue if you need any help using
the module, have any questions, or even have some feature suggestions.

<ins>Recommended Email format: </ins>

Subject: EventScheduler - [Issue]

Steps to reproduce: (Please include code snippets or stack trace where possible)

Device used:

Platform:

Actual result:

Expected result:

Comments:



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/phluentmed/event-scheduler",
    "name": "event-scheduler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Python Event Scheduler",
    "author": "Dil Mchaina, Farhan Ahmed",
    "author_email": "phluentmed@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ea/12/a78f551a8d434d30044fb5fc21cbe65a0451854c5293dec39b44dd59d7d1/event-scheduler-0.1.3.tar.gz",
    "platform": "",
    "description": "# Event Scheduler\n## Table of Contents\n- [Overview](#overview)\n- [Installing](#installing)\n- [Documentation](#documentation)\n- [Quick Start](#quick-start)\n- [Example](#example)\n- [Contact](#contact)\n\n### Overview\nThe Event Scheduler uses an internal thread to allow the application to \nschedule events to occur either ASAP or at a specified time in the future.\nInstead of blocking your application's main thread, you can concurrently run\nsome lightweight tasks. We took some inspiration for the API design from the\npython library's [scheduler](https://docs.python.org/3/library/sched.html). Unlike\nthe native sched module, the Event Scheduler is always on and ready to accept\nevents. Event Scheduler is completely thread-safe too!\n\n\n### Installing\nYou should already have pip installed if you're using python > 3.4. If you\ndon't, please visit this [link](https://pip.pypa.io/en/stable/installing/) to \ninstall it.\n\nTo install event scheduler, type the following command in the terminal:\n\n`pip install event-scheduler`\n\nTo import the module, add the following lines in your Python file.\n\n`from event_scheduler import EventScheduler`\n\nTo download directly visit [PyPi](https://pypi.org/project/event-scheduler/) or\nthe [GitHub repository](https://github.com/phluentmed/PythonEventScheduler).\n\n## Documentation\nFull documentation can be found [here](https://event-scheduler.readthedocs.io).\n### Quick Start\n`event_scheduler.start()`\n> Enable the event scheduler to start taking events\n\n`event_scheduler.stop(hard_stop=False)`\n>Stop the event scheduler and its internal thread. Set `hard_stop` to `True`\n>to stop the scheduler right away and discard all pending events. Set \n>`hard_stop` to `False` to wait for all events to finish executing at their\n>scheduled times.\n\n`event_scheduler.enter(delay, priority, action, arguments=(), kwargs={})`\n\n>Schedule an event with a callable `action` to be executed after the `delay`.\n>Events will be executed according to their `delay` and `priority` (lower \n>number = higher priority). `arguments` holds positional arguments and \n>`kwargs` hold keyword arguments for the action. Returns an event object which\n>can be used to cancel the event.\n\n`event_scheduler.cancel(event)`\n>Cancel the event if it has not yet been executed.\n\n`event_scheduler.cancel_recurring(event_id)`\n>Cancel the recurring event and all future occurrences. \n\n```python\nfrom event_scheduler import EventScheduler\n\nevent_scheduler = EventScheduler()\n# Starts the scheduler\nevent_scheduler.start()\n# Schedule an event that prints a message after 5 seconds\nevent_scheduler.enter(5, 0, print, ('5 seconds has passed since this event was entered!',))\n# Schedule a recurring event that prints a message every 10 seconds\nevent_scheduler.enter_recurring(10, 0, print, ('10 second interval has passed!',))\n```\nOutput:\n\\\n`5 seconds has passed since this event was entered!`\n\\\n`10 second interval has passed!`\n\\\n`10 second interval has passed!`\n\\\n`...`\n \n### Example\nPlease refer\n[here](https://github.com/phluentmed/event-scheduler/blob/master/example/transactions.py)\nfor the example. \n\n### Contact\nPlease email phluentmed@gmail.com or open an issue if you need any help using\nthe module, have any questions, or even have some feature suggestions.\n\n<ins>Recommended Email format: </ins>\n\nSubject: EventScheduler - [Issue]\n\nSteps to reproduce: (Please include code snippets or stack trace where possible)\n\nDevice used:\n\nPlatform:\n\nActual result:\n\nExpected result:\n\nComments:\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Always-on event scheduler",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://event-scheduler.readthedocs.io",
        "GitHub": "https://github.com/phluentmed/event-scheduler",
        "Homepage": "https://github.com/phluentmed/event-scheduler"
    },
    "split_keywords": [
        "python",
        "event",
        "scheduler"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd4743abbf321ceb61aad8e61800c29c708b2ef7bebe68513743bba40ae560b7",
                "md5": "0b16fbadceffaa24aa7b672e1a5c689b",
                "sha256": "f4a7f7da153badb9ac58e692e6448c86876dcf251fe1962f71ec864eba43366c"
            },
            "downloads": -1,
            "filename": "event_scheduler-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b16fbadceffaa24aa7b672e1a5c689b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 12166,
            "upload_time": "2022-01-06T06:22:35",
            "upload_time_iso_8601": "2022-01-06T06:22:35.771263Z",
            "url": "https://files.pythonhosted.org/packages/cd/47/43abbf321ceb61aad8e61800c29c708b2ef7bebe68513743bba40ae560b7/event_scheduler-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea12a78f551a8d434d30044fb5fc21cbe65a0451854c5293dec39b44dd59d7d1",
                "md5": "901c7a3b8b6eca9ab7bd18cbe7f95fc5",
                "sha256": "96d5b16ff23bc9df5f65d27e68c700d800fc78b4ec89ab7feb63bc940ab989d5"
            },
            "downloads": -1,
            "filename": "event-scheduler-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "901c7a3b8b6eca9ab7bd18cbe7f95fc5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10186,
            "upload_time": "2022-01-06T06:22:37",
            "upload_time_iso_8601": "2022-01-06T06:22:37.045804Z",
            "url": "https://files.pythonhosted.org/packages/ea/12/a78f551a8d434d30044fb5fc21cbe65a0451854c5293dec39b44dd59d7d1/event-scheduler-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-01-06 06:22:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "phluentmed",
    "github_project": "event-scheduler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "event-scheduler"
}
        
Elapsed time: 0.09473s