Scheduled jobs subsystem¶
The launch of the scheduled jobs is performed in two ways:
- in a separate process using the
bin/schedule.js
script - within the ION web application process (bin/www) by specifying the option
jobs.enabled=true
in the ini-file
In the second case, job management is possible to implement in a web application. Jobs are configured in the deploy.json file of the applications in the global settings section as a jobs parameter.
Example:¶
"jobs": {
"dummy": {
"launch": { // Периодичность запуска задания
"month": [2,5], // в феврале и мае
"week": 3, // каждую третью неделю (month и week - взаимоисключающие настройки),
"weekday": [1, 3, 5], // по понедельникам, средам и пятницам
"dayOfYear": 5, // раз в 5 дней в течение года,
"day": 10, // раз в 10 дней в течение месяца
"hour": 3, // раз в 3 часа
"minute": [10, 15, 35], // на 10-ой, 15-ой и 35-ой минуте
"sec": 10 // раз в 10 секунд
},
"di": { // скоуп задания
"dummy": {
"module": "applications/develop-and-test/jobs/dummy",
"options": {
}
}
},
"worker": "dummy", // имя компонента из скоупа задания, который будет исполняться
}
}
A component can be specified as a starting job, in this case it should have the run
method. A function can also be specified as a starting job. Then in di it is described similarly to the component, but using the executable
setting:
"di": {
"dummy": {
"executable": "applications/develop-and-test/jobs/dummy",
"options": {}
}
}
Example:¶
The jobs field in the global settings.
...
"jobs": {
"dummy": {
"launch": {
"sec": 30
},
"worker": "dummy",
"di": {
"dummy": {
"executable": "applications/develop-and-test/jobs/dummy"
}
}
}
...