File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
src/flyte/_internal/imagebuild Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 1+ import asyncio
2+
3+ import flyte
4+ from flyte import Image
5+
6+ # Start from an existing base image and clone it so the default configured builder picks it up.
7+ # The .clone() call assigns a name, which triggers a build.
8+ image = Image .from_base ("ghcr.io/flyteorg/flyte:py3.12-v2.0.0b56" ).clone (
9+ name = "my-flyte-image" ,
10+ )
11+
12+ env = flyte .TaskEnvironment (
13+ name = "my-flyte-task" ,
14+ image = image ,
15+ resources = flyte .Resources (cpu = "500m" , memory = "512Mi" ),
16+ )
17+
18+
19+ @env .task
20+ async def sleep_task (seconds : int = 10 ) -> str :
21+ print (f"Sleeping for { seconds } seconds..." , flush = True )
22+ await asyncio .sleep (seconds )
23+ print ("Done!" , flush = True )
24+ return f"Slept for { seconds } seconds"
25+
26+
27+ if __name__ == "__main__" :
28+ flyte .init_from_config ()
29+ run = flyte .run (sleep_task , seconds = 10 )
30+ print (run .name )
31+ print (run .url )
32+ run .wait ()
Original file line number Diff line number Diff line change @@ -142,9 +142,6 @@ class ImageBuildEngine:
142142 @staticmethod
143143 @alru_cache
144144 async def image_exists (image : Image ) -> Optional [str ]:
145- if image .base_image is not None and not image ._layers :
146- logger .debug (f"Image { image } has a base image: { image .base_image } and no layers. Skip existence check." )
147- return image .uri
148145 assert image .name is not None , f"Image name is not set for { image } "
149146
150147 tag = image ._final_tag
You can’t perform that action at this time.
0 commit comments