PHPackages                             oat-sa/extension-tao-scheduler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oat-sa/extension-tao-scheduler

ActiveTao-extension[Utility &amp; Helpers](/categories/utility)

oat-sa/extension-tao-scheduler
==============================

TAO job scheduler

v4.0.0(4mo ago)123.3k↓48.4%[1 PRs](https://github.com/oat-sa/extension-tao-scheduler/pulls)1GPL-2.0-onlyPHPCI passing

Since Feb 9Pushed 4mo ago40 watchersCompare

[ Source](https://github.com/oat-sa/extension-tao-scheduler)[ Packagist](https://packagist.org/packages/oat-sa/extension-tao-scheduler)[ Docs](http://www.taotesting.com)[ RSS](/packages/oat-sa-extension-tao-scheduler/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (35)Used By (1)

Tao task scheduler
==================

[](#tao-task-scheduler)

[RRULE](https://tools.ietf.org/html/rfc5545) standard is used to configure time and recurrence rule of each job.

Install
-------

[](#install)

```
$ composer require oat-sa/extension-tao-scheduler
```

Usage
-----

[](#usage)

### attach a job:

[](#attach-a-job)

```
use oat\taoScheduler\model\scheduler\SchedulerServiceInterface;
$schedulerService = $this->getServiceManager()->get(SchedulerServiceInterface::SERVICE_ID);
$schedulerService->attach(
    'FREQ=MONTHLY;COUNT=5',                     //Reccurrence rule (repeat monthly, 5 times)
    new \DateTime('2017-12-12 20:00:00'),       //Start date (time of first execution)
    ['taoExtension/ServiceName', 'methodName']  //Callback to be called.
);

```

Also cron notation may be used:

```
$schedulerService->attach(
    '* * * * *',                                //Reccurrence rule (repeat minutely)
    new \DateTime('2017-12-12 20:00:00'),       //Start date (time of first execution)
    ['taoExtension/ServiceName', 'methodName']  //Callback to be called.
);

```

*Note*:

> You can use any instance of callable type as callback except functions. In case if object is used (\[$object, 'method'\]) make sure that object is instance of `PhpSerializable`.
> Class name of `oat\oatbox\action\Action` instance may be used as a callback

### detach a job:

[](#detach-a-job)

```
use oat\taoScheduler\model\scheduler\SchedulerServiceInterface;
$schedulerService = $this->getServiceManager()->get(SchedulerServiceInterface::SERVICE_ID);
$schedulerService->detach(
    'FREQ=MONTHLY;COUNT=5',                     //Reccurrence rule (repeat monthly, 5 times)
    new \DateTime('2017-12-12 20:00:00'),       //Start date (time of first execution)
    ['taoExtension/ServiceName', 'methodName']  //Callback to be called.
);

```

All given parameters to `detach` function should be the same as in existing job.

### Run JobRunner

[](#run-jobrunner)

```
sudo -u www-data php index.php '\oat\taoScheduler\scripts\JobRunner' 1518006301 PT10S

```

- First parameter is a timestamp from which scheduler should start to look up scheduled tasks. All the tasks scheduled before this time will be ignored.

*Note*:

> Scheduled tasks may be executed even if their start date is later than timestamp given to job runner because they may be recurred and their start date is just a time of the first occurrence

If this parameter is omitted or less than 0 then start time will be taken from the storage (time of last seeking of scheduled job or time of last job runner iteration).
If there is no last iteration time in the storage current timestamp will be used.

- Second parameter is time between Job Runner iterations. Default value is 60 seconds. This time may be longer than configured because execution of tasks found during current iteration may take some time.

### Discover tasks to be run

[](#discover-tasks-to-be-run)

```
sudo -u www-data php index.php '\oat\taoScheduler\scripts\tools\SchedulerHelper' show 1518097355 1518100955

```

### Remove expired jobs from job storage (jobs which will not be executed anymore after given date):

[](#remove-expired-jobs-from-job-storage-jobs-which-will-not-be-executed-anymore-after-given-date)

```
sudo php index.php '\oat\taoScheduler\scripts\tools\SchedulerHelper' removeExpiredJobs false 1519890884

```

- First parameter is dryrun mode. `false` by default.
- Second parameter is time since which helper will try to find expired jobs (including given time). If parameter was not given then the last launch time of job runner will be used.

#### To run tasks through the task queue you may use `\oat\taoTaskQueue\scripts\tools\AddTaskToQueue` action.

[](#to-run-tasks-through-the-task-queue-you-may-use-oattaotaskqueuescriptstoolsaddtasktoqueue-action)

*Note*:

> taoScheduler does not require taoTaskQueue extension. Make sure that task queue is installed.

```
use oat\taoTaskQueue\scripts\tools\AddTaskToQueue;
$schedulerService->attach(
    '*/5 * * * *',
    new DateTime('now', new \DateTimeZone('utc')),
    AddTaskToQueue::class,
    [ActionClassToBeRun::class, 'param 1', 'param2']
);
```

### Warnings

[](#warnings)

1. Configure JobRunner service with common rds storage in case if scheduler is going to be run on multiserver environment.
2. Please do not schedule tasks which execution of which requires a lot of resource or take long time. All the time/resources consuming tasks should create appropriate tasks in the task queue. Ideally scheduled tasks should do nothing except adding tasks to the task queue.
3. Use cron syntax in case if number of occurrences is not limited.
4. iCalendar syntax is more flexible but in case of large or unlimited number of repeats there may be performance issues. By default limit of repeats is 732. More information:

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity27

Limited adoption so far

Community29

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~146 days

Recently: every ~445 days

Total

21

Last Release

134d ago

Major Versions

v0.9.0 → v1.0.12018-11-30

v1.1.0 → v2.0.02019-10-11

v2.3.0 → v3.0.02021-02-19

v3.0.4 → v4.0.02026-02-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/98ddc6f1b615b1fac2d59f1e72d5dc6056cf6650414271da90cb3f0e203516fe?d=identicon)[bugalood](/maintainers/bugalood)

![](https://www.gravatar.com/avatar/c0ec704e0a8abaf0c27b227ad05d7aca23bc8f83d195229d94d4508cddc0fd24?d=identicon)[oat-lionel](/maintainers/oat-lionel)

![](https://www.gravatar.com/avatar/e8c30644c0da147701176483ca1ca40e1c41012e6c5b0da47e984c1eb8a840b1?d=identicon)[jbout](/maintainers/jbout)

![](https://www.gravatar.com/avatar/348b2cf6408227372fbb22c6e8b0832e1c8c98c5d6b0c88bb220dbdfbcd21a39?d=identicon)[krampstudio](/maintainers/krampstudio)

---

Top Contributors

[![tikhanovichA](https://avatars.githubusercontent.com/u/1053022?v=4)](https://github.com/tikhanovichA "tikhanovichA (27 commits)")[![Yury-Razhkou](https://avatars.githubusercontent.com/u/51408369?v=4)](https://github.com/Yury-Razhkou "Yury-Razhkou (9 commits)")[![ionutpad](https://avatars.githubusercontent.com/u/31656944?v=4)](https://github.com/ionutpad "ionutpad (5 commits)")[![edwin-focaloid](https://avatars.githubusercontent.com/u/126317720?v=4)](https://github.com/edwin-focaloid "edwin-focaloid (4 commits)")[![shpran](https://avatars.githubusercontent.com/u/59471572?v=4)](https://github.com/shpran "shpran (4 commits)")[![jsconan](https://avatars.githubusercontent.com/u/1500098?v=4)](https://github.com/jsconan "jsconan (2 commits)")[![bartlomiejmarszal](https://avatars.githubusercontent.com/u/16231681?v=4)](https://github.com/bartlomiejmarszal "bartlomiejmarszal (2 commits)")[![uncleempty](https://avatars.githubusercontent.com/u/32706312?v=4)](https://github.com/uncleempty "uncleempty (2 commits)")[![krampstudio](https://avatars.githubusercontent.com/u/468620?v=4)](https://github.com/krampstudio "krampstudio (2 commits)")[![jbout](https://avatars.githubusercontent.com/u/5815304?v=4)](https://github.com/jbout "jbout (2 commits)")[![mike-ionut-mihai-sandu-tao](https://avatars.githubusercontent.com/u/50211080?v=4)](https://github.com/mike-ionut-mihai-sandu-tao "mike-ionut-mihai-sandu-tao (2 commits)")[![zagovorichev](https://avatars.githubusercontent.com/u/1445911?v=4)](https://github.com/zagovorichev "zagovorichev (1 commits)")[![alroniks](https://avatars.githubusercontent.com/u/303498?v=4)](https://github.com/alroniks "alroniks (1 commits)")[![AndreyNegrov](https://avatars.githubusercontent.com/u/18699340?v=4)](https://github.com/AndreyNegrov "AndreyNegrov (1 commits)")[![boajer](https://avatars.githubusercontent.com/u/4569734?v=4)](https://github.com/boajer "boajer (1 commits)")[![bugalot](https://avatars.githubusercontent.com/u/4217431?v=4)](https://github.com/bugalot "bugalot (1 commits)")[![gyszucs](https://avatars.githubusercontent.com/u/4942018?v=4)](https://github.com/gyszucs "gyszucs (1 commits)")[![julien-sebire](https://avatars.githubusercontent.com/u/47318116?v=4)](https://github.com/julien-sebire "julien-sebire (1 commits)")[![ks16](https://avatars.githubusercontent.com/u/42937157?v=4)](https://github.com/ks16 "ks16 (1 commits)")[![SergiiTao](https://avatars.githubusercontent.com/u/36041347?v=4)](https://github.com/SergiiTao "SergiiTao (1 commits)")

---

Tags

schedulerjobsTAOcomputer-based-assessmentOAT

### Embed Badge

![Health badge](/badges/oat-sa-extension-tao-scheduler/health.svg)

```
[![Health](https://phpackages.com/badges/oat-sa-extension-tao-scheduler/health.svg)](https://phpackages.com/packages/oat-sa-extension-tao-scheduler)
```

###  Alternatives

[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)[oat-sa/extension-tao-itemqti-pci

1087.5k11](/packages/oat-sa-extension-tao-itemqti-pci)[oat-sa/tao-community

TAO is an Open Source e-Testing platform that empowers you to build, deliver, and share innovative and engaging assessments online – in any language or subject matter.

105.3k1](/packages/oat-sa-tao-community)[oat-sa/generis

TAO generis library

10148.8k125](/packages/oat-sa-generis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
