from org.ow2.proactive.scripting.helper.selection import SelectionUtils
from org.ow2.proactive.scripting.helper.selection import Condition
from org.ow2.proactive.scripting.helper.selection import Conditions

#--We set our 2 conditions by creating "Condition" objects
condition1 = Condition("ram", SelectionUtils.GREATER_THAN, "1024");
condition2 = Condition("architecture", SelectionUtils.CONTAINS, "6");

#--We set a table of "Condition" objects
conditions = Conditions();

#--and put our 2 objects
conditions.add(condition1);
conditions.add(condition2);

#--Evaluation by calling CheckConfig method
if SelectionUtils.checkProperties(propertiesFile,conditions):
    selected = True;
else:
	selected = False;
#******************************************************
#* EXEMPLE SCRIPT : Using a selection utils method to select a host
#*****************************************************/
from org.ow2.proactive.scripting.helper.selection import SelectionUtils

#Check if java property 'a.jvm.property' value is 'toto'
if SelectionUtils.checkJavaProperty("a.jvm.property", "toto"):
	selected = true;
else:
	selected = false;
# Script using property file and two logical conditions

from org.ow2.proactive.scripting.helper.selection import SelectionUtils
from org.ow2.proactive.scripting.helper.selection import Condition
from org.ow2.proactive.scripting.helper.selection import Conditions

#-- We set our 2 conditions by creating "Condition" objects
condition1 = Condition("ram", SelectionUtils.GREATER_THAN, "1024");
condition2 = Condition("architecture", SelectionUtils.CONTAINS, "6");

#-- We create a list of "Condition" objects
conditions = Conditions();

#-- and insert our 2 objects
conditions.add(condition1);
conditions.add(condition2);

#-- Evaluation by calling CheckConfig method
if SelectionUtils.checkProperties("samples/scripts/selection/samplePropertiesFile.txt", conditions):
    selected = True;
else:
    selected = False;

from org.ow2.proactive.scripting.helper.selection import SelectionUtils

# Check if java property 'java.vendor' value is 'Oracle Corporation'
if SelectionUtils.checkJavaProperty("java.vendor", "Oracle Corporation"):
    selected = True;
else:
    selected = False;

Exemple #5
0
from org.ow2.proactive.scripting.helper.selection import SelectionUtils

# Check if java property 'java.vendor' value is 'Oracle Corporation'
if SelectionUtils.checkJavaProperty("java.vendor", "Oracle Corporation"):
    selected = True
else:
    selected = False
Exemple #6
0
# Script using property file and two logical conditions

from org.ow2.proactive.scripting.helper.selection import SelectionUtils
from org.ow2.proactive.scripting.helper.selection import Condition
from org.ow2.proactive.scripting.helper.selection import Conditions

#-- We set our 2 conditions by creating "Condition" objects
condition1 = Condition("ram", SelectionUtils.GREATER_THAN, "1024")
condition2 = Condition("architecture", SelectionUtils.CONTAINS, "6")

#-- We create a list of "Condition" objects
conditions = Conditions()

#-- and insert our 2 objects
conditions.add(condition1)
conditions.add(condition2)

#-- Evaluation by calling CheckConfig method
if SelectionUtils.checkProperties(
        "samples/scripts/selection/samplePropertiesFile.txt", conditions):
    selected = True
else:
    selected = False