tests/functional/client/black_box.py
def execute():
    """Execute a simple pipeline as an example."""
    parser = argparse.ArgumentParser()
    parser.add_argument("fct", type=str)
    parser.add_argument("--name", type=str)
    parser.add_argument("--objective", type=str)
    parser.add_argument("--data", type=str)
    parser.add_argument("-x", type=float)

    inputs = parser.parse_args()

    kwargs = {}

    # Maybe its a float, maybe user made a mistake and report objective='name'
    try:
        inputs.objective = float(inputs.objective)
    except (ValueError, TypeError):
        pass

    for key, value in vars(inputs).items():
        if value is not None:
            kwargs[key] = value

    kwargs.pop("fct")
    kwargs.pop("x")

    if "data" in kwargs:
        kwargs["data"] = [dict(name=kwargs["data"], type="constraint", value=1.0)]

    globals()[inputs.fct](**kwargs)
Execute a simple pipeline as an example.
Execute a simple pipeline as an example.
Execute a simple pipeline as an example .
def execute():
    parser = argparse.ArgumentParser()
    parser.add_argument("fct", type=str)
    parser.add_argument("--name", type=str)
    parser.add_argument("--objective", type=str)
    parser.add_argument("--data", type=str)
    parser.add_argument("-x", type=float)
    inputs = parser.parse_args()
    kwargs = {}
    try:
        inputs.objective = float(inputs.objective)
    except (ValueError, TypeError):
        pass
    for key, value in vars(inputs).items():
        if value is not None:
            kwargs[key] = value
    kwargs.pop("fct")
    kwargs.pop("x")
    if "data" in kwargs:
        kwargs["data"] = [dict(name=kwargs["data"], type="constraint", value=1.0)]
    globals()[inputs.fct](**kwargs)
def execute ( ) : parser = argparse . ArgumentParser ( ) parser . add_argument ( "fct" , type = str ) parser . add_argument ( "--name" , type = str ) parser . add_argument ( "--objective" , type = str ) parser . add_argument ( "--data" , type = str ) parser . add_argument ( "-x" , type = float ) inputs = parser . parse_args ( ) kwargs = { } try : inputs . objective = float ( inputs . objective ) except ( ValueError , TypeError ) : pass for key , value in vars ( inputs ) . items ( ) : if value is not None : kwargs [ key ] = value kwargs . pop ( "fct" ) kwargs . pop ( "x" ) if "data" in kwargs : kwargs [ "data" ] = [ dict ( name = kwargs [ "data" ] , type = "constraint" , value = 1.0 ) ] globals ( ) [ inputs . fct ] ( ** kwargs )
Execute a simple pipeline as an example.
Execute a simple pipeline as an example .
"""Execute a simple pipeline as an example.""" # Maybe its a float, maybe user made a mistake and report objective='name'