Example #1
0
def test_fetch_execute_workflow(flyteclient, flyte_workflows_register):
    remote = FlyteRemote(Config.auto(), PROJECT, "development")
    flyte_workflow = remote.fetch_workflow(
        name="workflows.basic.hello_world.my_wf", version=f"v{VERSION}")
    execution = remote.execute(flyte_workflow, {}, wait=True)
    assert execution.outputs["o0"] == "hello world"
    assert isinstance(execution.closure.duration, datetime.timedelta)
    assert execution.closure.duration > datetime.timedelta(seconds=1)

    execution_to_terminate = remote.execute(flyte_workflow, {})
    remote.terminate(execution_to_terminate, cause="just because")
Example #2
0
def test_execute_joblib_workflow(flyteclient, flyte_workflows_register,
                                 flyte_remote_env):
    remote = FlyteRemote(Config.auto(), PROJECT, "development")
    flyte_workflow = remote.fetch_workflow(
        name="workflows.basic.joblib.joblib_workflow", version=f"v{VERSION}")
    input_obj = [1, 2, 3]
    execution = remote.execute(flyte_workflow, {"obj": input_obj}, wait=True)
    joblib_output = execution.outputs["o0"]
    joblib_output.download()
    output_obj = joblib.load(joblib_output.path)
    assert execution.outputs["o0"].extension() == "joblib"
    assert output_obj == input_obj