24 lines
533 B
Python
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()
|