Skip to main content

UNKNOWN

Project description

MULTISCHED
==========

### Description

Multisched is a lightweight function scheduler module for python


### Usage

```python
from multisched import Scheduler
import time

s = Scheduler()

def timestamp(s):
print '%.2f : %s' % (time.time(), s)

class Action():
def __init__(self, name):
self.__name__ = name
self.call_counter = 0

def __call__(self):
self.call_counter += 1
print 'I am %s (%d)' % (self.__name__, self.call_counter)

# ----------------------------------.
# |
# TASK PARAMS: |
# |
# loopdelay: float, required |
# initdelay: float, default=0 |
# threads : int , default=0 |
# |
# ----------------------------------`
@s.AddTask(loopdelay=1.3)
def task1():
timestamp('task1')

@s.AddTask(loopdelay=1.0, initdelay=3)
def task2():
timestamp('task2')
time.sleep(1.6)
timestamp('task2 again')

@s.AddTask(loopdelay=1.1, threads=4)
def task3():
timestamp('task3')
time.sleep(4.4)
timestamp('task3 again')

s.AddTasks({'action' : Action('Agent%03d' % n)
,'loopdelay' : 0.6
,'initdelay' : 1.1
,'threads' : 0
} for n in xrange(42))
print s
s.StartAllTasks()
try:
raw_input()
except:
pass
s.StopAllTasks()

```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multisched-0.1.4.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file multisched-0.1.4.tar.gz.

File metadata

  • Download URL: multisched-0.1.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for multisched-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ace5cdc9c2cdf0bbe80a79d0f03dc8740f2bdbb72abbf5095e71b606dbc437d8
MD5 a4c04f119f27936aa5af31365eaf3b7e
BLAKE2b-256 460860ea285dd8634f9a0da7be903cc59f0f7aa7d2d2234d602625a70799c0eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page