forked from AOEpeople/Aoe_Scheduler
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fabrizio Branca
committed
Mar 6, 2015
1 parent
eac546f
commit 2228941
Showing
5 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Monitoring | ||
|
||
CLI/Webservice | ||
|
||
lastRun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Schedule a job programmatically | ||
|
||
``` | ||
$schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */ | ||
$schedule->setScheduledReason(Aoe_Scheduler_Model_Schedule::REASON_SCHEDULENOW_CLI); | ||
$schedule->setJobCode($code); | ||
$schedule->schedule(); | ||
$schedule->save(); | ||
``` | ||
|
||
## Run a job programmatically | ||
|
||
``` | ||
$schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */ | ||
$schedule->setJobCode($code); | ||
$schedule->setScheduledReason(Aoe_Scheduler_Model_Schedule::REASON_RUNNOW_CLI); | ||
$schedule->runNow(false); | ||
$schedule->save(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
- didn't do anything | ||
- success | ||
- error | ||
|
||
How to report a state back? | ||
## Schedule status | ||
|
||
### Default states (Mage_Cron_Model_Schedule) | ||
|
||
* STATUS_PENDING = 'pending'; | ||
* STATUS_RUNNING = 'running'; | ||
* STATUS_SUCCESS = 'success'; | ||
* STATUS_MISSED = 'missed'; | ||
* STATUS_ERROR = 'error'; | ||
|
||
### Additional states (Aoe_Scheduler_Model_Schedule | ||
|
||
* STATUS_KILLED = 'killed'; | ||
* STATUS_DISAPPEARED = 'gone'; | ||
* STATUS_DIDNTDOANYTHING = 'nothing'; | ||
|
||
TODO: | ||
- Explain all states | ||
- Convert this into a table? | ||
|
||
### How to report a state back? | ||
|
||
Only success, error and nothing can be actively reported back. The other states are being determined by the scheduler. | ||
|
||
Default state: success | ||
|
||
Simple way: Prepend return value with 'ERROR:' or 'NOTHING:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters