Hi Everyone, sorrect me if i am wrong but prefect ...
# prefect-community
n
Hi Everyone, sorrect me if i am wrong but prefect 2 does not has a skip state feature, so i was trying to implement the same using conditional flow using if else. for example here is my snipped of flow
Copy code
@flow(name="Inferencing")
def start_inferencing(my_param, file_path):
    job_id = my_param
    algo_id = "402"
    print(">>>>>>>>>>>>>>>>>>>>>>>>>>>")
    print(algo_id, job_id, file_path)
    print(">>>>>>>>>>>>>>>>>>>>>>>>>>>")
    res_1 = generate_jobID.submit(algo_id, job_id)
    print("\n\n\n\n ***************************\n\n\n\n ", res_1, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_1)
    res_2 = get_file.submit(file_path)
    print("\n\n\n\n ***************************\n\n\n\n ", res_2, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_2)
    res_4 = choose_valid_file.submit(prev_task=res_2)
    print("\n\n\n\n ***************************\n\n\n\n ", res_4, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_4)
    res_5 = prepare_request_upload.submit(prev_task=res_4)
    print("\n\n\n\n ***************************\n\n\n\n ", res_5, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_5)
    res_6 = send_data_request.submit(prev_task=res_5)
    print("\n\n\n\n ***************************\n\n\n\n ", res_6, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_6)
    res_7 = prepare_predict_request.submit(prev_task=res_6)
    print("\n\n\n\n ***************************\n\n\n\n ", res_7, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_7)
    res_8 = send_predict_request.submit(prev_task=res_7)
    print("\n\n\n\n ***************************\n\n\n\n ", res_8, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_8)
    res_9 = extract_lunit_jobid.submit(prev_task=res_8)
    print("\n\n\n\n ***************************\n\n\n\n ", res_9, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_9)
    res_10 = prepare_fetch.submit(prev_task=res_9)
    print("\n\n\n\n ***************************\n\n\n\n ", res_10, "\n\n\n\n ****************************\n\n\n\n")
    call_on_failure_if_failed(res_10)
    res_11 = fetch_request.submit(prev_task=res_10)
    call_on_failure_if_failed(res_11)
    print("\n\n\n\n ***************************\n\n\n\n ", res_11, "\n\n\n\n ****************************\n\n\n\n")
    if res_11:
        res_12 = convert_output.submit(prev_task=res_11)
        call_on_failure_if_failed(res_12)
        res_13 = zip_file.submit(prev_task=res_12)
        call_on_failure_if_failed(res_13)
        res_14 = send_to_HGW.submit(prev_task=res_13)
        call_on_failure_if_failed(res_14)
    else:
        send_log(job_id=job_id, header="AI Gateway", subheader="Failed to Receive Inferencing Result", status="failed",
                     level=5, direction=True, send_ip=SEND_IP, msg_id=8)
        

if __name__ == "main":
    start_inferencing_402(parameters=dict_)
the function res_12, res_13, res_14 i want to execute only if the res_11 gives True, By the way every function returns either true or false, Problem: 1. Not even one print statement is execuiting, 2. Also even if the res_11 is false then also res_12, res_13, res_14 is getting executed, Can anyone please tell me what i am doing wrong.
z
Not sure what’s up with your print statements, but you need to do
if res_11.result()
not just
if res_11
n
Yes tried that too but nothing worked
Is there any other way that I can implement skip state