Skip to content

Commit

Permalink
Added some more documenation
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Branca committed Mar 6, 2015
1 parent eac546f commit 2228941
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Has a status

![Job vs Schedule](images/job_schedule.png)

scheduled_by
scheduled_reason

### How does scheduling work?

- Generate schedules
Expand Down
5 changes: 5 additions & 0 deletions doc/monitoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Monitoring

CLI/Webservice

lastRun
19 changes: 19 additions & 0 deletions doc/programmatically.md
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();
```
31 changes: 27 additions & 4 deletions doc/states.md
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:'
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
1. [Timeline View](doc/timeline.md)
1. [Instructions](doc/instructions.md)
1. [Events](doc/events.md)
1. [Job States](doc/states.md)
1. [Schedule States](doc/states.md)
1. [CLI](doc/cli.md)
1. [Web Services](doc/web-services.md)
1. [Domain Model](doc/domain-model.md)
Expand All @@ -37,7 +37,8 @@
1. Cookbook
1. [Distributed cron](doc/distributed.md)
1. [Job workflows](doc/job-workflows.md)
1. [Schedule a job programmatically](doc/programmatically.md)
1. [Schedule a job programmatically](doc/programmatically.md)
1. [Monitoring](doc/monitoring.md)

## Changelog

Expand Down

0 comments on commit 2228941

Please sign in to comment.