Skip to content

Commit

Permalink
Added some more information to readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Branca committed Mar 6, 2015
1 parent efd1808 commit 625a4c8
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 12 deletions.
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

### Version 1.0.0

Cleanup (clean vocabulary: job, schedule, no task, no run)
Major release...
New domain model
Cron group
scheduler_cron.sh
Configuration (db) driven overlays
Edit jobs
Create new jobs
Process managmenet
Process managmenet
Major code cleanup and refactoring
Travis CI
22 changes: 21 additions & 1 deletion doc/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ What's new compared to native jobs?
- name, description,... (https://github.com/AOEpeople/Aoe_Scheduler/issues/46)
- groups
- parameters
- disable
- disable

### Schedule

Expand All @@ -43,3 +43,23 @@ scheduled_reason
- Detect duplicates


#### Job types

- xml
- db
- db_xml

crontab vs default/crontab
xml files vs database
- Explain how db is stored (native magento way)

Explain priorities (what's overlaying what?)

Specifically explain 'Cron configuration path' vs 'Cron expression' since a xml jobs 'cron expression' could be overwritten by an db overlay but at the same time there's a cron configuration path setting on the original or in the overlay record. Who wins?

- cron_configuration_path wins over cron_expr
- db_xml wins over xml

if db_xml's cron_configuration_path and the xml' cron_confiruation_path isn't then the latter one wins even is the db_xml has a cron_expression

Explain how empty field doesn't mean that this is a fallback, but that the field is actually empty. If the overlay field equals to the xml field than this will not be persistet (=fallback)
51 changes: 51 additions & 0 deletions doc/create-job.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Create a new job

### Job implementation

A job implementation is a simple callback. Your job class doesn't have to inherit from any specific class or implement any interface. You only need to create a model with a public method. Aoe_Scheduler will pass the current schedule object as a parameter in case you need to interact with it:

```php
class My_Module_Model_Job_Hello
{
/**
* Log 'Hello World'
*
* @param Aoe_Scheduler_Model_Schedule $schedule
*/
public function run(/* Aoe_Scheduler_Model_Schedule $schedule */)
{
Mage::log('Hello World');
}
}

```

### Register job in XML

In your modules config.xml file (e.g. `app/code/local/My/Module/etc/config.xml`) add this snippet to let Magento know about the job you've created:

```xml
<config>
<!-- ... -->
<crontab>
<jobs>
<mymodule_helloworld>
<schedule>
<cron_expr>*/5 * * * *</cron_expr>
</schedule>
<run>
<model>my_module/job_hello::run</model>
</run>
</mymodule_helloworld>
</jobs>
</crontab>
<!-- ... -->
</config>
```

**Hint:** instead of hardcoding your schedule in '<schedule><cron_expr>' you can use '<schedule><config_path>' instead pointing to a configuration option that holds your schedule. This configuration option can be made avilable through 'System > Configuration'.
On the other hand, Aoe Scheduler now let's you edit any job and overwrite any hardcoded schedule even if it wasn't pointing to a config path.

TODO: Add complete list of xml tags here, with description (e.g. what's the run>model syntax...)!

TODO: Add examples here of how to interact with Aoe_Scheduler through the $schedule object passed while calling the job.
6 changes: 4 additions & 2 deletions doc/faq.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Frequently asked questions
## Frequently asked questions

### Is there a way to run a single job like at the scheduler configuration with selecting the job and start "run now" via URL or something like that?

Expand Down Expand Up @@ -75,4 +75,6 @@ TODO...

### Will this work in version x?

TODO...
TODO...

### Will this work in version Windows?
36 changes: 36 additions & 0 deletions doc/heartbeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Heartbeat

The heartbeat is a simple job that doesn't do anything except helping you to verify that your Magento instance is configured correctly.

If everything is ok it will show a notice an all Aoe_Scheduler admin interfaces. If you're not seeing this message please check out the [instructions module](instructions.md) and fund some more information on how to [configure cron](cron-configuration.md) in this manual.

![](images/heartbeat.png)

### Monitoring

Sometimes - for various reasons - Magento's scheduler might stop working. Often there are business critical tasks that need to be run on a regular basis, so there's a need in monitoring the if everything works fine behind the scenes. That's why I added a new dummy job "Heartbeat". By default it runs every 5 minutes. This can be configured or even deactivated completely. This job does nothing but showing that the scheduler is working correctly.

In addition to that there is a new shell command that allows you the check when a task was run successfully the last time (works for all scheduler job - not only for the heartbeat job):

```
> php scheduler.php -action lastRun -code aoescheduler_heartbeat
1327960203
```

By adding the "-secondsFromNow" parameter you'll get the duration since the last execution:

```
> php scheduler.php -action lastRun -code aoescheduler_heartbeat -secondsFromNow
35
```

So you can use this to integrate your instance to whatever monitoring you're using. Using the default configuration the last value must not be bigger than 5x60 = 300 seconds. If it is, there's something wrong with your scheduler.

### Check any job

If you have any other critical job you can check specifically check when this job ran as well:
```
> php scheduler.php -action lastRun -code mymodule_helloworld
1327960263
```

Binary file modified doc/images/Aoe_Scheduler_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/cronsh_cronphp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/heartbeat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/webservice_role.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions doc/web-services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## Web Services

### Usage example

1. Create a web service **user role**:
Go to `System > Web Services -> Roles -> Role Resources` and set "Resource Access" to "all" or to "Custom" and select the specific options you want to grant to your web services user:
![](images/webservice_role.png)

2. Create a web service user and assign him to the previously created role (`System > Web Services > Users`)

3. Now you can access some scheduler functions (more might follow soon) via web service api. Currently only API v1 is implemented.


```php
<?php

$client = new SoapClient('http://yourhost/api/?wsdl');
$session = $client->login('your_username', 'your_api_key');

// Run a scheduler task
$result = $client->call($session, 'aoe_scheduler.runNow', array('aoecachecleaner'));
var_dump($result);
/*
array(7) {
["job_code"]=>
string(15) "aoecachecleaner"
["status"]=>
string(7) "success"
["created_at"]=>
string(19) "2011-11-15 20:55:41"
["scheduled_at"]=>
string(19) "2011-11-15 20:55:41"
["executed_at"]=>
string(19) "2011-11-15 20:55:41"
["finished_at"]=>
string(19) "2011-11-15 20:55:41"
["schedule_id"]=>
string(6) "150006"
}
*/

// Schedule a task to run (from a normal scheduler process) as soon a possible ...
$result = $client->call($session, 'aoe_scheduler.schedule', array('aoecachecleaner'));
// ... or at a given time (e.g. in 1 hour):
// $result = $client->call($session, 'aoe_scheduler.schedule', array('aoecachecleaner', time()+60*60));
var_dump($result);
/*
array(5) {
["job_code"]=>
string(15) "aoecachecleaner"
["status"]=>
string(7) "pending"
["created_at"]=>
string(19) "2011-11-15 21:06:07"
["scheduled_at"]=>
string(19) "2011-11-15 21:06:07"
["schedule_id"]=>
string(6) "150007"
}
*/

// Get information on an existing task
$result = $client->call($session, 'aoe_scheduler.info', array('150007'));
var_dump($result);
/*
array(5) {
["job_code"]=>
string(15) "aoecachecleaner"
["status"]=>
string(7) "pending"
["created_at"]=>
string(19) "2011-11-15 21:06:07"
["scheduled_at"]=>
string(19) "2011-11-15 21:06:07"
["schedule_id"]=>
string(6) "150007"
}
*/
```
23 changes: 15 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img style="float: right; height: 200px;" src="doc/images/Aoe_Scheduler_Icon.png">
<img align="right" style="float: right; height: 200px;" src="doc/images/Aoe_Scheduler_Icon.png">

# AOE Scheduler for Magento

Expand All @@ -21,12 +21,20 @@ Major Contributions:

Please get in touch with us via the [issue tracker on GitHub](https://github.com/AOEpeople/Aoe_Scheduler/issues)

## Compability

- PHP: 5.3, 5.4, 5.5
- Magento CE: 1.7.0.2 - 1.9.1.0
- Magento EE:
- Operating System: Linux

## Documentation

1. [What is AOE Scheduler?](doc/what-is-aoe-scheduler.md)
1. [Module Installation](doc/installation.md)
1. [Cron Configuration](doc/cron-configuration.md)
1. [Some Basics (Job? Schedule? Task?)](doc/basics.md)
1. [Some Basics (Job? Schedule? Task?)](doc/basics.md)
1. [Creating new jobs](doc/create-job.md)
1. [Faq](doc/faq.md)
1. Admin Interfaces
1. [System Configuration](doc/system-configuration.md)
Expand All @@ -41,23 +49,22 @@ Please get in touch with us via the [issue tracker on GitHub](https://github.com
1. [Domain Model](doc/domain-model.md)
1. [Cron Processing](doc/processing.md)
1. Features
1. [Heartbeat](doc/heartbeat.md)
1. [Heartbeat and Monitoring](doc/heartbeat.md)
1. [Notifications](doc/notifications.md)
1. [Custom job parameters](doc/custom-job-parameters.md)
1. [Global enabled/disable](doc/global-enable-disable.md)
1. [Disable individual jobs](doc/disable-individual-jobs.md)
1. [runNow](doc/run-now.md)
1. [runNow](doc/run-now.md)
1. [scheduleNow](doc/schedule-now.md)
1. [Run return values and communication](doc/communication.md)
1. [ETA](doc/eta.md)
1. [ETA](doc/eta.md)
1. [Watchdog](doc/watchdog.md)
1. [Cron groups](doc/cron-groups.md)
1. [Process Management](doc/process-management.md)
1. Cookbook
1. [Distributed cron](doc/distributed.md)
1. Cookbook
1. [Distributed cron](doc/distributed.md)
1. [Job workflows](doc/job-workflows.md)
1. [Schedule a job programmatically](doc/programmatically.md)
1. [Monitoring](doc/monitoring.md)

## Changelog

Expand Down

0 comments on commit 625a4c8

Please sign in to comment.