Optimizer

Launching the Jar

First, merge develop. Launch the migrations and a composer update. In a separated terminal, at project root:

$ cd var/optimizer
$ java -d64 -Xms512m -Xmx2g -cp openjet_validation-with-dep.jar com.openjet.ws.jetty.OpenjetJettyServer -port 8888 -sessionPoolMaxSize 30 -sessionPoolMinSize 9 -sessionPoolBlockTime 2

Warning

Make sure the -port parameter match your parameter.yml ‘default_optimizer_port’ parameter. Check that the parentUrl matches your local virtualhost.

More explanation with nohup strategy:

$ cd var
$ sudo chmod -R 777 optimizer
$ cd optimizer
$ nohup java -d64 -Xms512m -Xmx2g -cp openjet_validation-with-dep.jar com.openjet.ws.jetty.OpenjetJettyServer -port 8888 -sessionPoolMaxSize 30 -sessionPoolMinSize 9 -sessionPoolBlockTime 2 > /dev/null 2>/dev/null &

The last command gives back the hand once the jar is launched and cancels output.

Killing the Jar

Get jar’s PID :

$ ps -ef | grep {jar-port-number}

Kill the process using previously obtained PID :

$ sudo kill -9 {pid}

Initializing the Jar

Either get a clean sql dump from Develop or execute this command:

$ bin/console openjet:requirement:flight-time-rule

Note

This will ensure your flight time rules and associated entities are correctly created in your database.

Next, simply launch:

$ bin/console openjet:optimizer:init

You can check that the Optimizer is launched by checking the indicator in the menu : click on the little gear icon. If the indicator is green, everything’s fine !

On remote instance

On remote instance Optimizer is a service named optimizer, so you can use restart command:

$ sudo service optimizer restart

Note

Optimizer service run init command on post-start instruction.

Troubleshooting

If any issue, first check if you don’t have any exception during the init command (comment the try catch). If no exception, contact me on Slack @adrien.fuchs