Scheduled tasks

Index

Back: Functionality

The launch of the scheduled tasks is performed in two ways:

  1. in a separate process using the bin/schedule.js script
  2. within the ION web application process (bin / www) by specifying in the ini-file the option jobs.enabled=true

In the second case, task management is possible to implement in a web application. Tasks 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 task, in this case it should have the run method. A function can also be specified as a starting task. Then in di it is described similarly to the component, but using the executablesetting:

"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"
          }
        }
      }
...

License                                        Contact us                                         English

iondv metrics

Copyright (c) 2018 LLC “ION DV”.
All rights reserved.