Commit e325c05c authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

Update test workflow

parent 0446d260
......@@ -275,7 +275,8 @@ class Workflow(threading.Thread):
else:
value = None
# Set new parameter
if parameter.__class__ == StrParameter or parameter.__class__ == IntParameter or parameter.__class__ == FloatParameter or parameter.__class__ == BoolParameter or parameter.__class__ == DateParameter:
if parameter.__class__ in [StrParameter, IntParameter, FloatParameter, BoolParameter, DateParameter]:
if value == "" and parameter.__class__ in [IntParameter, FloatParameter, BoolParameter, DateParameter] : value = None # from GUI
new_param = ParameterFactory.factory( parameter.name, parameter.help, default=value, type=parameter.type, choices=parameter.choices,
required=parameter.required, flag=parameter.flag, group=parameter.group,
display_name=parameter.display_name )
......
......@@ -15,29 +15,45 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import sys
from jflow.workflow import Workflow
from jflow.parameter import InputFileList, InputFile
class Test (Workflow):
class Test (Workflow):
def get_description(self):
return "use for test jflow core modifications"
def define_parameters(self, parameters_section=None):
self.add_multiple_parameter_list("multi1", "Multiple.")
self.add_parameter("test_A1", "Multiple float null.", add_to="multi1", type="float")
self.add_parameter("test_A2", "Multiple float default 1.", add_to="multi1", type="float", default=1)
self.add_parameter("test_A3", "Multiple int default 2.", add_to="multi1", type=int, default=2)
self.add_parameter("test_A4", "Multiple int null.", add_to="multi1", type=int)
self.add_parameter("test_A5", "Multiple date default str '20/08/2014'.", add_to="multi1", type="date", default="20/08/2014")
self.add_parameter("test_A6", "date default null.", add_to="multi1", type="date")
self.add_parameter("test_A7", "Multiple string default str 'None'.", add_to="multi1", default="None")
self.add_parameter("test_A8", "Multiple string null.", add_to="multi1")
self.add_parameter("test_A9", "Multiple bool default True.", add_to="multi1", type="bool", default=True)
self.add_parameter("test_A10", "Multiple bool default 3.", add_to="multi1", type="bool", default=3)
self.add_parameter("test_A11", "Multiple bool default null.", add_to="multi1", type="bool")
self.add_input_file("test_A12", "Multiple InputFile default null.", add_to="multi1")
self.add_input_file("test_A13", "Multiple InputFile default application.properties.", add_to="multi1", default="application.properties")
self.add_parameter("test_E1", "float null.", type="float", group="test group")
self.add_parameter("test_E2", "float default 1.", type="float", default=1, group="test group")
self.add_parameter("test_E3", "int default 2.", type=int, default=2, group="test group")
self.add_parameter("test_E4", "int null.", type=int, group="test group")
self.add_parameter("test_E5", "date default str 20/08/2014.", type="date", default="20/08/2014", group="test group")
self.add_parameter("test_E6", "date default null.", type="date", group="test group")
self.add_parameter("test_E7", "string default str None.", default="None", group="test group")
self.add_parameter("test_E8", "string null.", group="test group")
self.add_parameter("test_E9", "bool default True.", type="bool", default=True, group="test group")
self.add_parameter("test_E10", "bool default false.", type="bool", default=False, group="test group")
self.add_parameter("test_E11", "bool default null.", type="bool", group="test group")
self.add_input_file("test_E12", "InputFile default null.", group="test group")
self.add_input_file("test_E13", "InputFile default application.properties.", default="application.properties", group="test group")
# self.add_multiple_parameter_list("multi1", "Multiple.")
# self.add_parameter("test_A1", "Multiple float null.", add_to="multi1", type="float")
# self.add_parameter("test_A2", "Multiple float default 1.", add_to="multi1", type="float", default=1)
# self.add_parameter("test_A3", "Multiple int default 2.", add_to="multi1", type=int, default=2)
# self.add_parameter("test_A4", "Multiple int null.", add_to="multi1", type=int)
# self.add_parameter("test_A5", "Multiple date default str '20/08/2014'.", add_to="multi1", type="date", default="20/08/2014")
# self.add_parameter("test_A6", "date default null.", add_to="multi1", type="date")
# self.add_parameter("test_A7", "Multiple string default str 'None'.", add_to="multi1", default="None")
# self.add_parameter("test_A8", "Multiple string null.", add_to="multi1")
# self.add_parameter("test_A9", "Multiple bool default True.", add_to="multi1", type="bool", default=True)
# self.add_parameter("test_A10", "Multiple bool default 3.", add_to="multi1", type="bool", default=3)
# self.add_parameter("test_A11", "Multiple bool default null.", add_to="multi1", type="bool")
# self.add_input_file("test_A12", "Multiple InputFile default null.", add_to="multi1")
# self.add_input_file("test_A13", "Multiple InputFile default application.properties.", add_to="multi1", default="application.properties")
self.add_parameter("test_B1", "float null.", type="float")
self.add_parameter("test_B2", "float default 1.", type="float", default=1)
self.add_parameter("test_B3", "int default 2.", type=int, default=2)
......@@ -49,59 +65,83 @@ class Test (Workflow):
self.add_parameter("test_B9", "bool default True.", type="bool", default=True)
self.add_parameter("test_B10", "bool default false.", type="bool", default=False)
self.add_parameter("test_B11", "bool default null.", type="bool")
self.add_input_file("test_B12", "Multiple InputFile default null.")
self.add_input_file("test_B13", "Multiple InputFile default application.properties.", default="application.properties")
self.add_multiple_parameter_list("multi2", "Multiple required.", required=True)
self.add_parameter("valid", "Multiple required.", add_to="multi2", default="ok")
self.add_parameter("test_C1", "Multiple float null.", add_to="multi2", type="float")
self.add_parameter("test_C2", "Multiple float default 1.", add_to="multi2", type="float", default=1)
self.add_parameter("test_C3", "Multiple int default 2.", add_to="multi2", type=int, default=2)
self.add_parameter("test_C4", "Multiple int null.", add_to="multi2", type=int)
self.add_parameter("test_C5", "Multiple date default str '20/08/2014'.", add_to="multi2", type="date", default="20/08/2014")
self.add_parameter("test_C6", "date default null.", add_to="multi2", type="date")
self.add_parameter("test_C7", "Multiple string default str 'None'.", add_to="multi2", default="None")
self.add_parameter("test_C8", "Multiple string null.", add_to="multi2")
self.add_parameter("test_C9", "Multiple bool default True.", add_to="multi2", type="bool", default=True)
self.add_parameter("test_C10", "Multiple bool default 3.", add_to="multi2", type="bool", default=3)
self.add_parameter("test_C11", "Multiple bool default null.", add_to="multi2", type="bool")
self.add_input_file("test_C12", "Multiple InputFile default null.", add_to="multi2")
self.add_input_file("test_C13", "Multiple InputFile default application.properties.", add_to="multi2", default="application.properties")##### Pb localfile and urlfile
self.add_input_file("test_B12", "InputFile default null.")
self.add_input_file("test_B13", "InputFile default application.properties.", default="application.properties")
self.add_input_file_list("test_B16", "InputFileList default null.")
# self.add_multiple_parameter_list("multi2", "Multiple list required.", required=True)
# self.add_parameter("valid", "Multiple required.", add_to="multi2", default="ok")
# self.add_parameter("test_C1", "Multiple float null.", add_to="multi2", type="float")
# self.add_parameter("test_C2", "Multiple float default 1.", add_to="multi2", type="float", default=1)
# self.add_parameter("test_C3", "Multiple int default 2.", add_to="multi2", type=int, default=2)
# self.add_parameter("test_C4", "Multiple int null.", add_to="multi2", type=int)
# self.add_parameter("test_C5", "Multiple date default str '20/08/2014'.", add_to="multi2", type="date", default="20/08/2014")
# self.add_parameter("test_C6", "date default null.", add_to="multi2", type="date")
# self.add_parameter("test_C7", "Multiple string default str 'None'.", add_to="multi2", default="None")
# self.add_parameter("test_C8", "Multiple string null.", add_to="multi2")
# self.add_parameter("test_C9", "Multiple bool default True.", add_to="multi2", type="bool", default=True)
# self.add_parameter("test_C10", "Multiple bool default 3.", add_to="multi2", type="bool", default=3)
# self.add_parameter("test_C11", "Multiple bool default null.", add_to="multi2", type="bool")
# self.add_input_file("test_C12", "Multiple InputFile default null.", add_to="multi2")
# self.add_input_file("test_C13", "Multiple InputFile default application.properties.", add_to="multi2", default="application.properties")##### Pb localfile and urlfile
# self.add_parameter_list("test_C14", "Multiple ParameterList [1, 2, 3]", add_to="multi2", default=[1, 2, 3])
# self.add_parameter_list("test_C15", "Multiple ParameterList default null", add_to="multi2")
# self.add_input_file_list("test_C16", "InputFileList default null.", add_to="multi2")
self.add_multiple_parameter("multi3", "Multiple required.")
self.add_parameter("valid", "Multiple required.", add_to="multi3", default="ok")
self.add_parameter("test_D1", "Multiple float null.", add_to="multi3", type="float")
self.add_parameter("test_D2", "Multiple float default 1.", add_to="multi3", type="float", default=1)
self.add_parameter("test_D3", "Multiple int default 2.", add_to="multi3", type=int, default=2)
self.add_parameter("test_D4", "Multiple int null.", add_to="multi3", type=int)
self.add_parameter("test_D5", "Multiple date default str '20/08/2014'.", add_to="multi3", type="date", default="20/08/2014")
self.add_parameter("test_D6", "date default null.", add_to="multi3", type="date")
self.add_parameter("test_D7", "Multiple string default str 'None'.", add_to="multi3", default="None")
self.add_parameter("test_D8", "Multiple string null.", add_to="multi3")
self.add_parameter("test_D9", "Multiple bool default True.", add_to="multi3", type="bool", default=True)
self.add_parameter("test_D10", "Multiple bool default 3.", add_to="multi3", type="bool", default=3)
self.add_parameter("test_D11", "Multiple bool default null.", add_to="multi3", type="bool")
self.add_input_file("test_D12", "Multiple InputFile default null.", add_to="multi3")
self.add_input_file("test_D13", "Multiple InputFile default application.properties.", add_to="multi3", default="application.properties")##### Pb localfile and urlfile
self.add_parameter_list("test_D14", "Multiple ParameterList [1, 2, 3]", add_to="multi3", default=[1, 2, 3])
self.add_parameter_list("test_D15", "Multiple ParameterList default null", add_to="multi3")
self.add_input_file_list("test_D16", "InputFileList default null.", add_to="multi3")
def process(self):
sys.stdout = open(os.path.join(self.directory, "wf_stdout"), 'w')
print "###################### Workflow ############################"
for attr in self.params_order:
value = getattr(self, attr)
print attr
print value
print "class : " + value.__class__.__name__
print "is None : " + str(value is None)
print "== None : " + str(value == None)
print ""
test_parameters = self.add_component("TestComponentParameters", [
self.test_B1,
self.test_B2,
self.test_B3,
self.test_B4,
self.test_B5,
self.test_B6,
self.test_B7,
self.test_B8,
self.test_B9,
self.test_B10,
self.test_B11,
self.test_B12,
self.test_B13,
self.multi2[0]["test_C1"],
self.multi2[0]["test_C2"],
self.multi2[0]["test_C3"],
self.multi2[0]["test_C4"],
self.multi2[0]["test_C5"],
self.multi2[0]["test_C6"],
self.multi2[0]["test_C7"],
self.multi2[0]["test_C8"],
self.multi2[0]["test_C9"],
self.multi2[0]["test_C10"],
self.multi2[0]["test_C11"],
self.multi2[0]["test_C12"],
self.multi2[0]["test_C13"]
])
\ No newline at end of file
sys.stdout.close()
# test_parameters = self.add_component("TestComponentParameters", [
# self.test_B1,
# self.test_B2,
# self.test_B3,
# self.test_B4,
# self.test_B5,
# self.test_B6,
# self.test_B7,
# self.test_B8,
# self.test_B9,
# self.test_B10,
# self.test_B11,
# self.test_B12,
# self.test_B13,
# self.multi2[0]["test_C1"],
# self.multi2[0]["test_C2"],
# self.multi2[0]["test_C3"],
# self.multi2[0]["test_C4"],
# self.multi2[0]["test_C5"],
# self.multi2[0]["test_C6"],
# self.multi2[0]["test_C7"],
# self.multi2[0]["test_C8"],
# self.multi2[0]["test_C9"],
# self.multi2[0]["test_C10"],
# self.multi2[0]["test_C11"],
# self.multi2[0]["test_C12"],
# self.multi2[0]["test_C13"]
# ])
\ No newline at end of file
......@@ -19,7 +19,6 @@ import os
from subprocess import Popen, PIPE
from jflow.component import Component
from jflow.parameter import Formats
class TestComponentParameters (Component):
def define_parameters(self, test_B1, test_B2, test_B3, test_B4, test_B5, test_B6, test_B7, test_B8, test_B9, test_B10, test_B11, test_B12, test_B13, test_C1, test_C2, test_C3, test_C4, test_C5, test_C6, test_C7, test_C8, test_C9, test_C10, test_C11, test_C12, test_C13):
......@@ -57,7 +56,7 @@ class TestComponentParameters (Component):
print attr
print value
print "class : " + value.__class__.__name__
print "is None : " + str(value is None)
# print "is None : " + str(value is None)
print "== None : " + str(value == None)
print ""
......
python bin/jflow_cli.py test \
--multi1 test-A1=1.1 test-A2=2 test-A3=3 test-A4=4 test-A5=02/09/2014 test-A6=03/09/2014 test-A7=test test-A8=None test-A11 test-A12=application.properties test-A13=bin/jflow_cli.py \
--test-B1 1.1 --test-B2 2 --test-B3 3 --test-B4 4 --test-B5 02/09/2014 --test-B6 03/09/2014 --test-B7 test --test-B8 None --test-B11 --test-B12 application.properties --test-B13 bin/jflow_cli.py \
--multi2 test-C1=1.1 test-C2=2 test-C3=3 test-C4=4 test-C5=02/09/2014 test-C6=03/09/2014 test-C7=test test-C8=None test-C11 test-C12=application.properties test-C13=bin/jflow_cli.py
--multi2 test-C1=1.1 test-C2=2 test-C3=3 test-C4=4 test-C5=02/09/2014 test-C6=03/09/2014 test-C7=test test-C8=None test-C11 test-C12=application.properties test-C13=bin/jflow_cli.py test-C14=9 test-C14=10 test-C14=11 test-C15=12,13,14 \
--multi2 test-C1=1.1 test-C2=2 test-C3=3 test-C4=4 test-C5=02/09/2014 test-C6=03/09/2014 test-C7=test test-C8=None test-C11 test-C12=application.properties test-C13=bin/jflow_cli.py test-C14=9,10,11 test-C15=12 test-C15=13 test-C15=14 \
--multi3 test-D1=1.1 test-D2=2 test-D3=3 test-D4=4 test-D5=02/09/2014 test-D6=03/09/2014 test-D7=test test-D8=None test-D11 test-D12=application.properties test-D13=bin/jflow_cli.py test-D14=9,10,11 test-D15=12 test-D15=13 test-D15=14
\ No newline at end of file
python bin/jflow_cli.py test --multi2 valid=test
\ No newline at end of file
python bin/jflow_cli.py test --multi2 valid=test --multi3 valid=test
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment