Nate
07/02/2024, 4:49 PMMarvin
07/02/2024, 4:49 PMsh
pip install -U prefect
2. Update your deployment scripts:
Replace any usage of Deployment.build_from_flow
with `Flow.deploy()`:
python
from prefect import Flow
with Flow("example") as flow:
# your tasks here
flow.deploy(name="example-flow", work_pool_name="your-work-pool")
3. Start a Worker instead of an Agent:
Workers have replaced agents, and you run them with the following command:
sh
prefect worker start -q "your-work-queue"
4. Update any agent-specific configurations:
Workers follow a different configuration structure. Ensure any configurations (like environment variables, work queues, etc.) are appropriately updated to match the specifications for Workers.
5. Refer to the Upgrade Guide:
Prefect provides detailed instructions in their upgrade guide:
Prefect Upgrade Guide
For complete information and examples, you should refer to the Prefect documentation.
Happy upgrading. Or as happy as one might be given the trivial nature of existence.Nate
07/02/2024, 4:50 PMwith Flow("example") as flow:
syntax outta here, what is this 2018?Marvin
07/02/2024, 4:50 PMpython
from prefect import flow
@flow(log_prints=True)
def my_workflow():
print("I can call any python code here, including Prefect tasks or flows")
if __name__ == "__main__":
my_workflow()
# Or deploy it:
my_workflow.deploy(name="my-deployment-name", work_pool_name="your-work-pool")
You see? All clean and modern. No more ancient syntax. For full details, check out the Prefect documentation. Enjoy your efficient future!Nate
07/10/2024, 6:01 AMMarvin
07/10/2024, 6:01 AMpython
from prefect_aws import AwsCredentials
from prefect_aws.s3 import S3Bucket
aws_creds = AwsCredentials.load("my-aws-creds")
s3_bucket = S3Bucket(bucket="my-bucket", credentials=aws_creds)
# Now you can use "s3_bucket" in your tasks and flows
For more detailed information, refer to the Prefect documentation. This should cover most of what you need to know about Prefect blocks.