Files
prefect-code/test2.py
yhydev 501b2922f4 init
2025-12-02 16:09:13 +08:00

24 lines
533 B
Python

import datetime
from prefect import flow, task
import time
import requests
@task(name="My Example Task",
description="An example task for a tutorial.",
task_run_name="hello-{name}-on-{date:%A}")
def my_task(name, date):
res = requests.get("http://ipinfo.io").text
print(res)
time.sleep(60)
pass
@flow
def my_flow():
# creates a run with a name like "hello-marvin-on-Thursday"
my_task(name="marvin", date=datetime.datetime.now(datetime.timezone.utc))
if __name__ == "__main__":
my_flow()