Ejemplo n.º 1
0
def run(submitter=None):
    """To submit the workflow using user-provided submitter implementation.
       Note that, the provided submitter must have a submit function which
       takes the workflow YAML as input.
    """
    states._enable_print_yaml = False

    if submitter is None and ArgoSubmitter._default_submitter is None:
        raise ValueError(
            "The input submitter is None and default submitter was not set."
        )
    wf = workflow_yaml()
    secrets = states._secrets.values()
    validate_workflow_yaml(wf)

    if submitter is not None:
        if isinstance(submitter, ArgoSubmitter):
            res = submitter.submit(wf, secrets=secrets)
        elif issubclass(submitter, ArgoSubmitter):
            submitter = ArgoSubmitter()
            res = submitter.submit(wf, secrets=secrets)
        else:
            raise ValueError("Only ArgoSubmitter is supported currently.")
    else:
        res = ArgoSubmitter._default_submitter.submit(wf, secrets=secrets)

    # Clean up the saved states of the workflow since we made a copy of
    # the workflow above and no longer need the original reference. This
    # would also allow users to define a new workflow after submission.
    _cleanup()
    return res
Ejemplo n.º 2
0
def run(submitter=ArgoSubmitter):
    """To submit the workflow using user-provided submitter implementation.
       Note that, the provided submitter must have a submit function which
       takes the workflow YAML as input.
    """
    states._enable_print_yaml = False

    if submitter is None:
        raise ValueError("The input submitter is None")
    wf = workflow_yaml()
    secrets = states._secrets.values()
    validate_workflow_yaml(wf)
    if isinstance(submitter, ArgoSubmitter):
        return submitter.submit(wf, secrets=secrets)
    elif issubclass(submitter, ArgoSubmitter):
        submitter = ArgoSubmitter()
        return submitter.submit(wf, secrets=secrets)
    else:
        raise ValueError("Only ArgoSubmitter is supported currently.")
Ejemplo n.º 3
0
def run(submitter=ArgoSubmitter):
    """To submit the workflow using user-provided submitter implementation.
       Note that, the provided submitter must have a submit function which
       takes the workflow YAML as input.
    """
    states._enable_print_yaml = False

    if submitter is None:
        raise ValueError("The input submitter is None")
    wf = workflow_yaml()
    # TODO (terrytangyuan): Decouple with Argo and then uncomment this
    # validate_workflow_yaml(wf)
    if isinstance(submitter, ArgoSubmitter):
        return submitter.submit(wf)
    elif issubclass(submitter, ArgoSubmitter):
        submitter = ArgoSubmitter()
        return submitter.submit(wf)
    else:
        raise ValueError("Only ArgoSubmitter is supported currently.")