-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathcontainer_images.py
More file actions
47 lines (35 loc) · 866 Bytes
/
container_images.py
File metadata and controls
47 lines (35 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# container_images.py
# /// script
# dependencies = [
# "polars",
# "flyte"
# ]
# ///
import polars as pl
import flyte
env = flyte.TaskEnvironment(
name="polars_image",
image=flyte.Image.from_uv_script(
__file__,
name="flyte",
registry="ghcr.io/flyteorg",
).with_apt_packages("ca-certificates"),
)
@env.task
async def create_dataframe() -> pl.DataFrame:
return pl.DataFrame(
{"name": ["Alice", "Bob", "Charlie"], "age": [25, 32, 37], "city": ["New York", "Paris", "Berlin"]}
)
@env.task
async def print_dataframe(dataframe: pl.DataFrame):
print(dataframe)
@env.task
async def workflow():
df = await create_dataframe()
await print_dataframe(df)
if __name__ == "__main__":
flyte.init_from_config()
run = flyte.run(workflow)
print(run.name)
print(run.url)
run.wait()