# ask-the-community

Endre Karlson

11/28/2023, 2:26 PM
Can I break in a workflow? Or rather if a task / workflow at a certain point doesn't match n criteria i'd like to stop execution in a parent workflow

Haytham Abuelfutuh

11/28/2023, 4:52 PM
hmmm you can add validation tasks if that's what you mean, things like:
Copy code
def check_output(i: int):
  if i < 0:
    raise Error("...

def my_wf() -> int:
  a = t1()
  check1 = check_output(o=a)
  b = t2()
  check2 = check_output(o=b)

  # Ensure that check1 runs before b is produced even when t2() 
  # doesn't depend on the output of check_output
  check1 >> b

  # return the final output
  return b

Endre Karlson

11/28/2023, 5:17 PM
Oh yeah