Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-7916: GA Grid examples should be ready for auto run on TeamCity #3638

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,8 +45,8 @@
* -DAMOUNTCHANGE=75
*
* <p> Remote nodes should always be started with special configuration file which enables P2P class loading: {@code
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup
* in another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup in
* another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
*/

public class OptimizeMakeChangeGAExample {
Expand All @@ -68,17 +68,21 @@ public class OptimizeMakeChangeGAExample {
public static void main(String args[]) {
System.setProperty("IGNITE_QUIET", "false");

sAmountChange = System.getProperty("AMOUNTCHANGE");
sAmountChange = "75";

StringBuffer sbErrorMessage = new StringBuffer();
sbErrorMessage.append("AMOUNTCHANGE System property not set. Please provide a valid value between 1 and 99. ");
sbErrorMessage.append(" ");
sbErrorMessage.append("IE: -DAMOUNTCHANGE=75");
sbErrorMessage.append("\n");
sbErrorMessage.append("Using default value: 75");

//Check if -DAMOUNTCHANGE JVM system variable is provided
if (sAmountChange == null) {
if (System.getProperty("AMOUNTCHANGE") == null) {
System.out.println(sbErrorMessage);
System.exit(1);
}
else {
sAmountChange = System.getProperty("AMOUNTCHANGE");
}

try {
Expand Down Expand Up @@ -149,6 +153,7 @@ public static void main(String args[]) {
Chromosome fittestChromosome = gaGrid.evolve();

Ignition.stop(true);

ignite = null;

}
Expand Down
Expand Up @@ -28,7 +28,6 @@
import org.apache.ignite.ml.genetic.Gene;
import org.apache.ignite.ml.genetic.parameter.GAConfiguration;


/**
* This example demonstrates how to use the GAGrid framework.
*
Expand All @@ -42,8 +41,8 @@
* mvn exec:java -Dexec.mainClass="org.apache.ignite.examples.ml.genetic.helloworld.HelloWorldGAExample"
*
* <p> Remote nodes should always be started with special configuration file which enables P2P class loading: {@code
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup
* in another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup in
* another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
*/

public class HelloWorldGAExample {
Expand Down Expand Up @@ -87,6 +86,7 @@ public static void main(String args[]) {
Chromosome fittestChromosome = gaGrid.evolve();

Ignition.stop(true);

ignite = null;

}
Expand Down
Expand Up @@ -42,8 +42,8 @@
* mvn exec:java -Dexec.mainClass="org.apache.ignite.examples.ml.genetic.movie.MovieGAExample" -DGENRES=Action,Comedy
*
* <p> Remote nodes should always be started with special configuration file which enables P2P class loading: {@code
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup
* in another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
* 'ignite.{sh|bat} examples/config/example-ignite.xml'}.</p> <p> Alternatively you can run ExampleNodeStartup in
* another JVM which will start node with {@code examples/config/example-ignite.xml} configuration.</p>
*/

public class MovieGAExample {
Expand All @@ -63,16 +63,21 @@ public static void main(String args[]) {
System.setProperty("IGNITE_QUIET", "false");

List genres = new ArrayList();
String sGenres = System.getProperty("GENRES");
String sGenres = "Action,Comedy,Romance";

StringBuffer sbErrorMessage = new StringBuffer();
sbErrorMessage.append("GENRES System property not set. Please provide GENRES information.");
sbErrorMessage.append(" ");
sbErrorMessage.append("IE: -DGENRES=Action,Comedy,Romance");
sbErrorMessage.append("\n");
sbErrorMessage.append("Using default value: Action,Comedy,Romance");

if (sGenres == null) {
if (System.getProperty("GENRES") == null) {
System.out.println(sbErrorMessage);
System.exit(1);

}
else {
sGenres = System.getProperty("GENRES");
}

StringTokenizer st = new StringTokenizer(sGenres, ",");
Expand Down