Skip to content

Commit

Permalink
Use the "pio instance" command.
Browse files Browse the repository at this point in the history
  • Loading branch information
dszeto committed Sep 12, 2014
1 parent 91fccfd commit d592228
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 14 deletions.
62 changes: 50 additions & 12 deletions docs/manual/engines/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,59 @@ title: Engines

# Engines

Each engine represents a type of prediction.
Each engine represents a type of prediction.

## Getting Started with Engine Instance

Let say you want to launch an instance of Item Recommendation Engine for product recommendation.
Let say you want to launch an instance of Item Recommendation Engine for product
recommendation. First of all, you will need to create an engine instance
project. The new project will contain configuration for your engine instance.

```
$ $PIO_HOME/bin/pio instance io.prediction.engines.itemrec
$ cd io.prediction.engines.itemrec
```
where `$PIO_HOME` is your installation path of PredictionIO.

### Specific which App the instance is targeted to

### Specific the Target App

Inside the engine instance project, edit `params/datasource.json` and change the
value of `appId` to fit your app.

```
(TODO)
{
"appId": 1,
"actions": [
"view",
"like",
"conversion",
...
```

### Launching an Engine Instance

```
$ cd $PIO_HOME/engines/item-rec
$ ../../bin/pio train
$ ../../bin/pio <TODO>
$ $PIO_HOME/bin/pio train
...
2014-09-11 16:25:44,591 INFO spark.SparkContext - Job finished: collect at Workflow.scala:674, took 0.078664 s
2014-09-11 16:25:44,737 INFO workflow.CoreWorkflow$ - Saved engine instance with ID: KxOsC2FRSdGGe1lv0oaHiw
```
You may launch more than one engine instance in PredictionIO.
where `$PIO_HOME` is your installation path of PredictionIO.

If your training was successful, you should see the lines shown above. Now you are ready to deploy the instance:

```
$ $PIO_HOME/bin/pio deploy
...
[INFO] [09/11/2014 16:26:16.525] [pio-server-akka.actor.default-dispatcher-2] [akka:https://pio-server/user/IO-HTTP/listener-0] Bound to localhost/127.0.0.1:8000
[INFO] [09/11/2014 16:26:16.526] [pio-server-akka.actor.default-dispatcher-5] [akka:https://pio-server/user/master] Bind successful. Ready to serve.
```

> The `deploy` command runs the engine instance in the foreground. To run more
than one engine instance, either launch a new console, or put the process into
the background, then repeat the same command on a different port (by adding a
`--port` argument).

If it is your first time using PredictionIO, these [tutorials and samples](/tutorials/engines/) should be helpful.

Expand All @@ -35,13 +69,17 @@ You may set up a crontab in Linux to update the predictive model with new data r
```
$ crontab -e
0 */6 * * * cd <PIO_HOME>/engines/item-rec; ../../bin/pio train; ../../bin/pio deploy
0 */6 * * * cd <engine instance project directory>; $PIO_HOME/bin/pio train; $PIO_HOME/bin/pio deploy
```
where `<PIO_HOME>` is your installation path of PredictionIO.
where `$PIO_HOME` is your installation path of PredictionIO.

> The `deploy` command will automatically undeploy any running engine instance
on the same IP address and port. It is not necessary to use the `undeploy`
command.

## Built-in Engines

PredictionIO comes with the following engines.
PredictionIO comes with the following engines.

* [Item Ranking](/engines/itemrank)
* [Item Recommendation](/engines/itemrec)
Expand All @@ -51,4 +89,4 @@ You may start with these [tutorials and samples](tutorials.html).

## Building your own Engine

Please read the [Engine Builders' Guide](/enginebuilders/) for details.
Please read the [Engine Builders' Guide](/enginebuilders/) for details.
4 changes: 2 additions & 2 deletions docs/manual/tutorials/engines/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ can run multiple recommendation *engine instances* at the same time with
different settings, or even for different projects.

To launch an engine instance for this simple app, first create an engine
project:
instance project:

```
$ $PIO_HOME/bin/pio new io.prediction.engines.itemrec
$ $PIO_HOME/bin/pio instance io.prediction.engines.itemrec
$ cd io.prediction.engines.itemrec
```

Expand Down

0 comments on commit d592228

Please sign in to comment.