Task Scheduler

  • In order for your site to run properly there are a few background processes that either run automatically or can be set to run at different times. Some of these background processes include running the mail queue, updating statistics, and performing general site maintenance. You can view and control these background processes in the Task Scheduler. Some plugins can also have their own background processes that will be added to the Task Scheduler list. 

    Accessing the Task Scheduler Page

    To access the Task Scheduler page, you will need to be logged into the admin panel. You can then go to Settings > Task Scheduler.

    The Task Scheduler Page will allow you to view the tasks, background processes that run periodically, and the statistics of how often they were run and how often they succeeded.

    Filtering the Task Scheduler List

    If you would like to only see information on certain jobs or would like to change the sorting of the tasks shown in the Task Scheduler, you can set a filter by selecting various options in the filter box.

    Module

    You can chose what type of task you would like to view by clicking on the arrow button under “Module”. The available selections may vary depending on whether any third-party plugins have been installed. The two default options are "Core" and "Members". "Core" tasks are tasks that take care of administration and the running of the site. "Members" tasks are tasks that involve Member data such as maintenance.

    Order

    You can chose how you would like to sort the tasks that are displayed by clicking on the arrow button under “Order”. You can choose from: "ID"," Name", "Timeout", and "Module".

    ID - will sort the tasks by their ID number.

    Name - will sort the tasks by the name of the tasks.

    Timeout - will sort the tasks by how long a task's timeout is.

    Module - will place one group of modules in front of the other for example all the Core modules will be shown before the Member modules.

    Direction

    You can choose whether to sort by ascending or descending for the Order that was chosen (discussed above) by clicking on the arrow button under “Direction”. The "A-Z" option would sort the items alphabetically in an ascending order, whereas the "Z-A" option would sort the items alphabetically in a descending order.

    Settings Information

    Basic information about the task scheduler settings can be found under the Filter box which will describe how the Task Scheduler is currently set up. For instance, how often the tasks are checked, how long the timeout for a task to run is, and if the tasks are ready to be run again.

    There is also an “Enable Auto-Refresh” button which will allow the page to refresh its contents every few minutes to show you updated information without you having to refresh the page. To turn off the Enable Auto-Refresh, you can click on the “Disable Auto-Refresh button”.

    Running a Task

    You can run a Task that isn't already running at any time by checking the box of the task you would like to run (For example: the Background Mailer).

    You can select multiple tasks by checking the boxes next to all the tasks you would like to run. Checking the box in the title bar will automatically check all the boxes in the list for you.

    Once you have selected all the tasks you would like to run, click on the "Run Selected Now" button to start running the tasks on your system.

    Reset Statistics

    If you would like to clear all the current statistics and start with a clean slate from this moment on, you can click the "Reset Statistics" button at the bottom of your screen.

    Viewing the Job Queue

    If you would like to view background jobs that aren't set to automatically run by themselves, such as Video Encodes, you can view them in the Job Queue by clicking on the “Job Queue” tab. Jobs are run once and completed, unlike tasks which are periodically run every few seconds or minutes.

    Filtering the Job Queue

    The Job Queue can be filtered similar to the Task Schedule list to only show the jobs that you would like to see. The Job Queue filter has most of the same sorting features as the Task Scheduler except for the addition of “Type” and “State”.

    Module

    You can chose what type of job you would like to view based on the module it is a part of by clicking on the arrow button under “Module”. The available selections may vary depending on whether any third-party plugins have been installed.

    Type

    You can chose what type of job you would like to view by clicking on the arrow button under “Type”. The list that is available under “Type” will be all of the jobs that can currently be run in the Job Queue, however, not all of them will be run and some of them may never be run.

    State

    You can chose if you would like to see only jobs with a certain state by clicking on the arrow button under "State". The different states available are: “Pending”, “Active”, “Sleeping”, “Failed”, “Cancelled”, “Completed”, and “Timed Out”.

    Pending - jobs that are waiting to run. They may be in the process of setting up certain things in order to run.

    Active - jobs that are currently running.

    Sleeping - jobs that have timed out due to reaching the Time per Request set in the Task Scheduler Settings.

    Failed - jobs that were unable to be completed do to an error while running or when they have reached the Process Timeout set in the Task Scheduler Settings.

    Order

    You can chose how you would like to sort the jobs that are displayed by clicking on the arrow button under “Order”. You can choose from: "ID", "Type", "State", "Progress", "Queued Date", "Started Date", "Completed Date", and "Priority".

    ID - will sort the jobs by their ID number.

    Type - will sort the jobs by their Name.

    State - will sort the jobs by their current state.

    Progress - will sort jobs by how much they have progressed.

    Queued Date - will sort jobs by when they were put into the Job Queue.

    Started Date - will sort jobs by when they started to run.

    Completed Date - will sort jobs by when they were completed.

    Priority - will sort jobs by their priority. Those with a higher priority will be run first.

    Direction

    You can choose whether to sort alphabetically by ascending or descending for the “Order” that was chosen (discussed above) by clicking on the arrow button under “Direction” just like the Task Scheduler Filter.

    Task Scheduler Settings

    If you feel familiar with how the Task Scheduler runs and would like to change some of its settings, you can do so in the “Task Scheduler Settings” tab.

    Trigger Method

    The “Trigger Method” is how the jobs are run by your system. We recommend the defaults to be cURL or Socket since they use asynchronous HTTP requests. However, if you would like to have more control over the scheduling of when the jobs run, you can switch to Cron. You will need to setup cron in crontab or Windows Task Scheduler if you switch to Cron. If all three of the above are not working or not available, then you can try using Javascript which uses Ajax to call the jobs.

    If you have enabled Maintenance Mode, you will need to use the PHP cron command if you want to use Cron.

    Click the drop down selector to change the “Trigger Method”.

    Trigger Access Key

    The “Trigger Access Key” is a randomly generated key used in the configuration of the system running the jobs to prevent unauthorized jobs from running in the task scheduler. To regenerate the key, click on the "(generate)" button.

    Trigger Interval

    The “Trigger Interval” sets how long the Task Scheduler should wait before running the next set of jobs. This is set in seconds. Enter the value you want in the input box.

    Concurrent Processes

    This is the number of processes (tasks + jobs) that are allowed to run at the same time. If your server has more cpu resources then you can try increasing the number of “Concurrent Processes”.

    Tasks Run per Request

    The “Tasks Run per Request” is the number of times a certain job can run during one batch of tasks run in the Task Scheduler. If a task is determined to have done nothing, it may not count towards this number.

    Time per Request

    The “Time per Request” is the maximum time a job is allowed to run before it is stopped. If your server allows ini_get() to read the php server's max_execution_time directive, then it will automatically change it to the max_execution_time set by the PHP server.

    Process Timeout

    The “Process Timeout” is the maximum time a job is allowed to be kept sleeping before it is deemed as a failed job. After the job has been marked as failed, the job will be freed to be able to run again either manually or during the next cycle.

    Concurrent Jobs

    This is the maximum number of jobs that can run at the same time. The number of jobs will not be able to run more “Concurrent Jobs” than the number of “Concurrent Processes” allowed above. If there are 3 “Concurrent Processes” allowed in the system and no tasks are running on the system, it will only be able to run at most 3 “Concurrent Jobs”. If your server has more cpu resources you can try increasing the number of “Concurrent Jobs”.

    You will need to click on the "Save Changes" button at the bottom of the screen to save any changes you have made to the Task Scheduler Settings before they will take effect.

    Task Scheduler Log

    If you would like to view the log file that has more detailed information about the processes that were run in the Task Scheduler and Job Queue, such as why they failed, then you can find this information in the “Task Scheduler Log”. To access the “Task Scheduler Log”, you can click on the “Task Scheduler Log” tab which will redirect you to the Log Browser with the “Task Scheduler Log” already selected.

    You can change the amount of log items that show by selecting the drop down next to “Task schedule log” and choose more or less lines to show at once. Click “View Log” to see the results. If you want to clear the log files, click “Clear Log." To download the logs, click “Download Log'"

    Troubleshooting

    If you find that your task scheduler doesn't run with cURL and your host has it enabled, please have the host enable allow_url_fopen  in PHP, or you can change to Cron.