# ``twisted`.`application`.`internet`.`TimerService``

class documentation

`class TimerService(_VolatileDataService): (source)`

Known subclasses: `twisted.mail.mail.FileMonitoringService`

View In Hierarchy

Service to periodically call a function

Every `step` seconds call the given function with the given arguments. The service starts the calls when it starts, and cancels them when it stops.

Method | `__init__` |
Method | `startService` | Start the service.
Method | `stopService` | Stop the service.
Class Variable | `volatile` | Undocumented
Instance Variable | `call` | Function and arguments to call periodically.
Instance Variable | `clock` | Source of time. This defaults to `None` which is causes `twisted.internet.reactor` to be used. Feel free to set this to something else, but it probably ought to be set *before* calling `startService`.
Instance Variable | `step` | Undocumented
Method | `_failed` | Undocumented
Instance Variable | `_loop` | Undocumented
Instance Variable | `_loopFinished` | Undocumented

Inherited from `_VolatileDataService`:

Method | `__getstate__` | Undocumented

Inherited from `Service` (via `_VolatileDataService`):

Method | `disownServiceParent` | Use this API to remove an `IService` from an `IServiceCollection`.
Method | `privilegedStartService` | Do preparation work for starting the service.
Method | `setName` | Set the name of the service.
Method | `setServiceParent` | Set the parent of the service. This method is responsible for setting the `parent` attribute on this service (the child service).
Instance Variable | `name` | A `str` which is the name of the service or `None`.
Instance Variable | `parent` | An `IServiceCollection` which is the parent or `None`.
Instance Variable | `running` | A `boolean` which indicates whether the service is running.

def __init__(self, step, callable, *args, **kwargs): (source)
overridden in `twisted.mail.mail.FileMonitoringService`

Parameters
step:`float` | The number of seconds between calls.
callable:`callable` | Function to call
*args | Positional arguments to pass to function
**kwargs | Keyword arguments to pass to function

def startService(self): (source)
from `twisted.application.service.IService`
overrides `twisted.application.service.Service.startService`
overridden in `twisted.mail.mail.FileMonitoringService`
Start the service.
def stopService(self): (source)
from `twisted.application.service.IService`
overrides `twisted.application.service.Service.stopService`
overridden in `twisted.mail.mail.FileMonitoringService`
Stop the service.

Returns
`Deferred` | a `Deferred` which is fired when the currently running call (if any) is finished.

volatile: `list[str]` = (source)
overrides `twisted.application.internet._VolatileDataService.volatile`

Undocumented

call: `tuple` of `(callable, args, kwargs)` = (source)
Function and arguments to call periodically.
clock: `IReactorTime` = (source)
Source of time. This defaults to `None` which is causes `twisted.internet.reactor` to be used. Feel free to set this to something else, but it probably ought to be set *before* calling `startService`.
step = (source)

Undocumented

def _failed(self, why): (source)

Undocumented

_loop = (source)

Undocumented

_loopFinished = (source)

Undocumented