Jai P
04/03/2022, 6:44 PMflow.visualize()
in prefect 1.0 (not using radar)? If not, are there plans to add that functionality?Anna Geller
Jai P
04/03/2022, 7:30 PMAnna Geller
we can't easily traverse the dependencies of a flow since there aren't necessarily Edges anymore, right?Can you explain what problem do you try to solve this way? When it comes to unit testing your flows and tasks, Prefect 2.0 makes testing actually much easier by not being restrictive about what should be in your flow (i.e., Prefect 1.0 only allows calling tasks and setting dependencies, while 2.0 allows running arbitrary code). So you can test any custom behavior you like, depending on what would you want to test. A good approach would be thinking about how would you test your workflow without Prefect
Anna Geller
Jai P
04/03/2022, 11:14 PMJai P
04/03/2022, 11:17 PMAnna Geller
our own custom visualization layer that isn't radarCan you explain why? Curious to hear what did you find lacking there?
Jai P
04/04/2022, 2:36 AMJai P
04/04/2022, 2:39 AMAnna Geller
Jai P
04/04/2022, 1:05 PMA -> B (person waiting here) -> C -> E <- D
|
V
E
Anna Geller
Jai P
04/04/2022, 2:36 PMAnna Geller
from prefect import task, flow
from prefect import get_run_logger
@task
def get_value_for_key_from_redis() -> dict:
return {"name": "Marvin"}
@task
def process_personal_data_step_a(user: dict):
logger = get_run_logger()
if user.get("A") is not None:
<http://logger.info|logger.info>("processing step A")
# do some action here
else:
<http://logger.info|logger.info>("Step A is already done")
@task
def process_personal_data_step_b(user: dict):
logger = get_run_logger()
if user.get("B") is not None:
<http://logger.info|logger.info>("processing step B")
# do some action here e.g. adding age:
user["age"] = 42
else:
<http://logger.info|logger.info>("Step B is already done")
return user
@task
def load_final_key_back_to_redis(user_dict: dict) -> None:
pass # load this dict back to Redis
@flow
def hw():
user_data = get_value_for_key_from_redis()
step_a = process_personal_data_step_a(user_data)
step_b = process_personal_data_step_b(step_a)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by