This bundle provides a set of commands to interact with your tasks
- Listing tasks
- Listing failed tasks
- Consuming tasks
- Executing tasks
- Rebooting the scheduler
- Retrying a failed task
- Removing a failed task
- Stopping the worker
- Yielding a task
- Probe
- Executing external probe
- Debugging the middleware list
- Debugging the transport configuration
Description: List every tasks scheduled
$ bin/console scheduler:list
Description: List every task that have failed during execution
$ bin/console scheduler:list:failed
Description: Consume due tasks
$ bin/console scheduler:consume
This command allows using multiple options to filter consumed tasks (each one can be combined):
--limit
: Define the maximum amount of due tasks to consume.--time-limit
: Define the maximum amount in seconds before the worker stop.--failure-limit
: Define the maximum amount of tasks that can fails during consumation.--wait
: Set the worker to an "infinite" wait loop where tasks are consumed then the worker wait until next minute.--force
: Force the worker to wait for tasks even if no tasks are currently available.--lazy
: Force the scheduler to retrieve the tasks using lazy-loading.--strict
: Force the scheduler to check the date before retrieving the tasks.
-
The scheduler will only return tasks that haven't been executed since the last minute.
-
The command filter tasks returned by the scheduler by checking if each task is not paused (the worker will do this if the
--wait
option is set). -
The output of each executed task can be displayed if the
-vv
option is used. -
By default, when using
--wait
, the command will stop if no tasks can be found, thanks to--force
, you can ask the worker to wait without stopping the command for the next minute and check again the tasks. -
When using
--lazy
, tasks are retrieve using aLazyTaskList
, this can improve performances BUT keep in mind that using this approach can trigger edge cases when checking due tasks. -
When using
--strict
, keep in mind thatSchedulerInterface::getDueTasks()
is called twice, first, the command will check if tasks can be found using a strict comparison on the current date then the worker will retrieve the tasks using the same approach, if the worker didn't receive any tasks, it will start the sleeping phase until next minute.
Introduced in 0.5
Description: Execute a set of tasks (due or not) depending on filters
$ bin/console scheduler:execute
This command allows using multiple options to filter consumed tasks (each one can be combined):
--due
: Execute due tasks.--namme
: Allows to specify a set of tasks (depending on their name) that must be executed.--expression
: Allows to specify a set of tasks (depending on their expression) that must be executed.--tags
: Allows to specify a set of tasks (depending on their tags) that must be executed.
- Depending on
--due
option, the scheduler will execute the due tasks or each tasks that match the submitted options. - The worker is automatically stopped once each task has been consumed.
Description: Remove every task (except the ones using @reboot
expression) and reboot the scheduler
$ bin/console scheduler:reboot
Description: Remove a task that has failed during execution
$ bin/console scheduler:remove:failed **taskname**
Description: Stop the worker after the current task has been executed
$ bin/console scheduler:stop-worker
Description: Retry a task that has failed during execution
$ bin/console scheduler:retry:failed **taskname**
Introduced in 0.3
Description: Yield a task
More information: The behaviour behind "yielding" a task is to un-schedule it then immediately re-schedule it.
$ bin/console scheduler:yield **task**
Using the --force
option:
$ bin/console scheduler:retry foo --force
[OK] The task "foo" has been yielded
Using the question:
$ bin/console scheduler:retry foo --force
Do you want to yield this task? (yes/no) [no]:
> yes
[OK] The task "foo" has been yielded
Using the --force
option and the --async
one:
$ bin/console scheduler:retry foo --async --force
[OK] The task "foo" has been yielded
PS: Using the async
option forces the scheduler to call the message bus, this approach requires
that you call the related command from it to consume messages
Introduced in 0.5
Description: Display the probe state along with (if defined) the external probe states
$ bin/console scheduler:debug:probe
This command allows using additional options to display information:
--external
: Define if the external probes state must be displayed.
$ bin/console scheduler:debug:probe
[INFO] The displayed probe state is the one found at 2021-05-17T17:24:56+00:00
+----------------+--------------+-----------------+
| Executed tasks | Failed tasks | Scheduled tasks |
+----------------+--------------+-----------------+
| 0 | 0 | 0 |
+----------------+--------------+-----------------+
- With external probes state
$ bin/console scheduler:debug:probe --external
[INFO] The displayed probe state is the one found at 2021-05-17T17:24:56+00:00
+----------------+--------------+-----------------+
| Executed tasks | Failed tasks | Scheduled tasks |
+----------------+--------------+-----------------+
| 0 | 0 | 0 |
+----------------+--------------+-----------------+
[INFO] Found 1 external probe
+------+-----------------+--------+-----------------------------------+-----------------+
| Name | Path | State | Last execution | Execution state |
+------+-----------------+--------+-----------------------------------+-----------------+
| foo | /_external_path | paused | Tuesday, 18-May-2021 16:26:34 UTC | Not executed |
+------+-----------------+--------+-----------------------------------+-----------------+
Introduced in 0.5
Description: Execute external probe
$ bin/console scheduler:execute:external-probe
// TODO
Introduced in 0.6
Description: Display the middleware list (both scheduler and worker)
$ bin/console scheduler:debug:middleware
$ bin/console scheduler:debug:middleware
[INFO] Found 2 middleware for the scheduling phase
+------------------------+---------------+----------------+----------+----------+
| Name | PreScheduling | PostScheduling | Priority | Required |
+------------------------+---------------+----------------+----------+----------+
| TaskCallbackMiddleware | Yes | Yes | 1 | No |
| NotifierMiddleware | Yes | Yes | 2 | No |
+------------------------+---------------+----------------+----------+----------+
[INFO] Found 6 middleware for the execution phase
+-------------------------+--------------+---------------+----------+----------+
| Name | PreExecution | PostExecution | Priority | Required |
+-------------------------+--------------+---------------+----------+----------+
| TaskCallbackMiddleware | Yes | Yes | 1 | No |
| NotifierMiddleware | Yes | Yes | 2 | No |
| ProbeTaskMiddleware | Yes | No | No | No |
| TaskLockBagMiddleware | No | Yes | 5 | No |
| TaskUpdateMiddleware | No | Yes | 10 | Yes |
| SingleRunTaskMiddleware | No | Yes | 15 | Yes |
+-------------------------+--------------+---------------+----------+----------+
// TODO