.

SchedulerBaseController Class Reference

SchedulerController. More...

Inheritance diagram for SchedulerBaseController:
ControllerBase IController IEventSink

List of all members.

Public Member Functions

  action_scheduler_process ($page_data)
  Scheduler Action to execute the next task.
  action_scheduler_test ($page_data)
  A simple task to be invoked for testing purposes.
  action_scheduler_watchdog ($page_data)
  Look for tasks that obiously have crashed and treat them as failed.
  before_action ()
  Load classes before action.
  get_routes ()
  Returns array of routes.

Detailed Description

SchedulerController.

Definition at line 6 of file scheduler.basecontroller.php.


Member Function Documentation

SchedulerBaseController::action_scheduler_process ( page_data  ) 

Scheduler Action to execute the next task.

Parameters:
PageData  $page_data

Definition at line 33 of file scheduler.basecontroller.php.

00033                                                              {
00034                 $task = Scheduler::get_next_task();
00035                 if ($task) {
00036                         $cmd = CommandsFactory::create_command('scheduler', 'process', $task);
00037                         $page_data->status = $cmd->execute();
00038                 }
00039         }
SchedulerBaseController::action_scheduler_test ( page_data  ) 

A simple task to be invoked for testing purposes.

Does nothing but sleeping for half a minute

Parameters:
PageData  $page_data

Definition at line 63 of file scheduler.basecontroller.php.

00063                                                           {
00064                 sleep(0.5 * Date::ONE_MINUTE);
00065         }
SchedulerBaseController::action_scheduler_watchdog ( page_data  ) 

Look for tasks that obiously have crashed and treat them as failed.

It may happen that a task is processed but crashes due to memory or time limitations. Since these events can not be catched within PHP, the watchdogs checks for tasks staying PROCESSING for longer then two hours and closes them, respecting the error rescheduling policies.

Parameters:
PageData  $page_data

Definition at line 51 of file scheduler.basecontroller.php.

00051                                                               {
00052                 $cmd = CommandsFactory::create_command('scheduler', 'cleanup', false);
00053                 $page_data->status = $cmd->execute();
00054         }
SchedulerBaseController::before_action (  ) 

Load classes before action.

Reimplemented from ControllerBase.

Definition at line 24 of file scheduler.basecontroller.php.

00024                                         {
00025                 Load::models('scheduler');
00026         }
SchedulerBaseController::get_routes (  ) 

Returns array of routes.

Returns:
array

Reimplemented from ControllerBase.

Definition at line 12 of file scheduler.basecontroller.php.

00012                                      {
00013                 $ret = array(
00014                         'process' => new ExactMatchRoute('scheduler/process', $this, 'scheduler_process', new ConsoleOnlyRenderDecorator()),
00015                         'test' => new ExactMatchRoute('scheduler/test', $this, 'scheduler_test', new ConsoleOnlyRenderDecorator()),
00016                         'watchdog' => new ExactMatchRoute('scheduler/watchdog', $this, 'scheduler_watchdog', new ConsoleOnlyRenderDecorator())
00017                 );
00018                 return $ret;
00019         }

The documentation for this class was generated from the following file: