Questions tagged [prefect]

Prefect is a Python-based workflow management system (ETLs are an example use-case). Users organize Tasks into Flows, define dependencies, schedules, etc., and Prefect takes care of the rest.

Prefect

Prefect is an open-source workflow and orchestration framework, written in Python 3, that bills itself as an up-and-coming alternative to Airflow. Its design philosophy emphasizes the benefits of negative engineering: that is, features designed to manage the failure and recoverability of workflows as a natural extension of normal development. Its creators also tout the benefits of its hybrid execution model, whereby orchestration occurs with zero knowledge of either the code being run or the data being manipulated. It also boats features such as first-class workflow scheduling, dynamic task generation, and horizontal workflow scalability via out-of-the-box integration with Dask Distributed.

Prefect consists of three components:

  • Prefect Core: the central features of development in the Prefect ecosystem, by which Tasks are composed into directed acyclic graphs (DAGs) called Flows.
  • Prefect Server: the GraphQL application and UI that, taken together, allow users to manage flow submission and execution in an easy-to-use and interactive manner.
  • Prefect Cloud: the optional commercial offering of the Prefect maintainers, which organizations can use to leverage managed infrastructure in addition to the benefits of Prefect Server.

More information about Prefect is available at:

179 questions
5
votes
1 answer

How to assign a name to a control_flow in prefect?

How do you assign a name to a merge task in a flow? thing_three = merge(thing_one, thing_two) The ultimate goal is to retrieve merge using flow.get_tasks(name="thing_merger") Thanks in advance.
Itay Livni
  • 2,143
  • 24
  • 38
5
votes
1 answer

How does one update a prefect Flow with duplicate parameters?

Using prefect, I would like to create a new flow from two other flows. The error I am getting is A task with the slug "add_num" already exists in this flow. Is it possible to update Flows that use the same tasks or Parameters. Below is a minimal…
Itay Livni
  • 2,143
  • 24
  • 38
4
votes
2 answers

Error to create a flow in prefect for python using with and object Flow()

Hi everyone I was trying to create a flow using prefect for python but I get the error TypeError: 'fn' must be callable, I already install all the packages and I have tried in different IDE like vs code and colab but the result is the same. the…
Hardroco
  • 41
  • 2
4
votes
1 answer

Prefect Flow runs : How to send run logs to prefect server?

I'm currently trying to run some prefect Flows in my local machine (then in some Google cloud runs instances) and I would like to send runs logs to a distant prefect server. Here's the example code : @task def my_task(): logger =…
AlaeddineB
  • 41
  • 2
4
votes
1 answer

How to get in prefect core local task final state?

I have built a flow which implicitly skips running a given task if a kwarg is empty. I use something like this within task function for skipping logic: if kwargs.get('processors', Hierarchy()).__len__() == 0: raise…
D_usv
  • 433
  • 7
  • 21
4
votes
1 answer

How to handle a task failure in prefect and return SUCCESS with the on_failure param?

I have a Flow in prefect whose with a task whose output is a dataframe. In the example provided below it always fails. I would like the task to return an empty dataframe with the state of SUCCESS using @task(on_failure=handle_task_fail). What is…
Itay Livni
  • 2,143
  • 24
  • 38
3
votes
3 answers

How do you schedule some python scripts to run regularly on a Windows PC?

I have some python scripts that I look to run daily form a Windows PC. My current workflow is: The desktop PC stays all every day except for a weekly restart over the weekend After the restart I open VS Code and run a little bash script ./start.sh…
MYK
  • 1,988
  • 7
  • 30
3
votes
1 answer

Prefect2.0 How to trigger a flow using just curl?

Here is my dead simple flow: from prefect import flow import datetime @flow def firstflow(inreq): retval={} retval['type']=str(type(retval)) retval['datetime']=str(datetime.datetime.now()) print(retval) return retval I run prefect…
Bino Oetomo
  • 571
  • 1
  • 10
  • 23
3
votes
1 answer

Prefect Server: No Tenant Found

I am attempting to spin up a Prefect Agent, in order to complete the setup with a Prefect Server. Rather than using prefect server start for out-of-the-box setup, I used prefect server config to generate the Docker Compose file and then docker…
Michael Wheeler
  • 849
  • 1
  • 10
  • 29
3
votes
0 answers

Splitting tasks using Prefect

I need to create a batch that can process tasks with this workflow: | task 4 | task 3 ->| task 4 | task 2 -> | task 4 …
serg
  • 31
  • 3
3
votes
2 answers

How to cache/target tasks with the same name in a Flow with prefect?

I am trying to find a target pattern or cache config to differentiate between tasks with the same name in a flow. As highlighted from the diagram above only one of the tasks gets cached and the other get overwritten. I tried using task-slug but to…
Itay Livni
  • 2,143
  • 24
  • 38
3
votes
1 answer

Combine a Parameterized Prefect flow with a Schedule that varies by parameter

I'd like to be be able to re-use the same Parameterized Prefect flow, but where the Schedule varies by inputs. So for example: from prefect import task, Flow, Task, Parameter from prefect.schedules import CronSchedule diurnal = ['rooster',…
Daniel Egan
  • 826
  • 1
  • 9
  • 22
2
votes
1 answer

Kubernetes prefect UI cannot connect to api

So I am having an issue with prefect-server UI connecting to my API within my kubernetes environment. I am using a nginx as my ingress. I have my ingress configuration for the prefect-server service as so: https://myhost.com/prefect/ ->…
cozzymotto
  • 83
  • 1
  • 2
  • 13
2
votes
1 answer

Is there a way to have 3 snowflake databases in the same DBT model?

I have a dbt project which gets the data from MySQL loads in RAW db in snowflake, transforms and loads in ANALYTICS db in snowflake. Now I have a requirement to create a table in a third database PROD in snowflake which aggregates data from…
2
votes
1 answer

How to dynamically rename a task run based on passed variable from within a Prefect flow for Prefect 2.0?

I have a prefect task that will source a table by name from a database as below. What I would like to do is to have the task run name include the source table variable so that I can easily keep track of it from the Prefect Cloud UI (when I source…
sinjacks
  • 33
  • 4
1
2
3
11 12