Esempio n. 1
0
def history():
    if "component_name" not in request.args:
        return error(f"component_name not specified.", HTTPStatus.NOT_FOUND)

    component_name = request.args["component_name"]
    limit = request.args["limit"] if "limit" in request.args else None
    date_upper = (
        parser.parse(request.args["date_upper"])
        if "date_upper" in request.args
        else None
    )
    date_lower = (
        parser.parse(request.args["date_lower"])
        if "date_lower" in request.args
        else None
    )

    try:
        history = (
            get_history(component_name, limit, date_lower, date_upper)
            if limit
            else get_history(
                component_name, date_lower=date_lower, date_upper=date_upper
            )
        )
        return str(history)
    except RuntimeError:
        return error(
            f"Component {component_name} has no runs", HTTPStatus.NOT_FOUND
        )
Esempio n. 2
0
def history(component_name: str, limit: int, address: str = ""):
    """
    CLI for history of ComponentName.
    """
    # Set address
    if address and len(address) > 0:
        set_address(address)
    history = (get_history(component_name, limit)
               if limit else get_history(component_name))
    show_history(history)
Esempio n. 3
0
def history():
    if "component_name" not in request.args:
        return error(f"component_name not specified.", HTTPStatus.NOT_FOUND)

    component_name = request.args["component_name"]
    limit = request.args["limit"] if "limit" in request.args else None

    try:
        history = (get_history(component_name, limit)
                   if limit else get_history(component_name))
        return str(history)
    except RuntimeError:
        return error(f"Component {component_name} has no runs",
                     HTTPStatus.NOT_FOUND)