clever-exabyte-82294
05/25/2024, 11:17 AMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
glamorous-carpet-83516
05/26/2024, 7:14 AMclever-exabyte-82294
05/26/2024, 8:26 AMimport time
from datetime import datetime
import pytz
from flytekit import Resources, task, workflow
def dt():
utc_now = datetime.now(pytz.utc)
print(str(utc_now))
return time.time()
@task(interruptible=True, retries=2)
def timed_task(a: int) -> dict:
a1 = dt()
print("Hello, I should take time ", a, a1)
time.sleep(a)
a2 = dt()
print("I am done", a2)
return {"a":a, "diff": a2-a1}
@workflow
def time_taken_wf() -> None:
timed_task(a=20) >> timed_task(a=20) >> timed_task(a=20)
timed_task(a=25)
timed_task(a=40)
timed_task(a=100)
I am using default docker image.clever-exabyte-82294
05/26/2024, 8:28 AMapiVersion: v1
kind: Pod
metadata:
annotations:
<http://cluster-autoscaler.kubernetes.io/safe-to-evict|cluster-autoscaler.kubernetes.io/safe-to-evict>: "false"
primary_container_name: fc200e7ff601b48c2840-n1-0
creationTimestamp: "2024-05-26T08:22:34Z"
labels:
domain: development
execution-id: fc200e7ff601b48c2840
interruptible: "true"
my-label: my-project
node-id: n1
project: my-project
shard-key: "16"
task-name: app-timed-task
workflow-name: app-time-taken-wf
name: fc200e7ff601b48c2840-n1-0
namespace: my-project-development
ownerReferences:
- apiVersion: <http://flyte.lyft.com/v1alpha1|flyte.lyft.com/v1alpha1>
blockOwnerDeletion: true
controller: true
kind: flyteworkflow
name: fc200e7ff601b48c2840
uid: 16a7a111-fbbd-4f52-afb5-d3878733616e
resourceVersion: "12158"
uid: 567d4ee4-7dba-4140-82b1-7ec4684d1207
spec:
affinity: {}
containers:
- args:
- pyflyte-fast-execute
- --additional-distribution
- <s3://my-s3-bucket/my-project/development/EBR637LASIENUKDJPWFUXA47K4======/script_mode.tar.gz>
- --dest-dir
- .
- --
- pyflyte-execute
- --inputs
- <s3://my-s3-bucket/metadata/propeller/my-project-development-fc200e7ff601b48c2840/n1/data/inputs.pb>
- --output-prefix
- <s3://my-s3-bucket/metadata/propeller/my-project-development-fc200e7ff601b48c2840/n1/data/0>
- --raw-output-data-prefix
- <s3://my-s3-bucket/data/sd/fc200e7ff601b48c2840-n1-0>
- --checkpoint-path
- <s3://my-s3-bucket/data/sd/fc200e7ff601b48c2840-n1-0/_flytecheckpoints>
- --prev-checkpoint
- '""'
- --resolver
- flytekit.core.python_auto_container.default_task_resolver
- --
- task-module
- app
- task-name
- timed_task
env:
- name: FLYTE_INTERNAL_EXECUTION_WORKFLOW
value: my-project:development:app.time_taken_wf
- name: FLYTE_INTERNAL_EXECUTION_ID
value: fc200e7ff601b48c2840
- name: FLYTE_INTERNAL_EXECUTION_PROJECT
value: my-project
- name: FLYTE_INTERNAL_EXECUTION_DOMAIN
value: development
- name: FLYTE_ATTEMPT_NUMBER
value: "0"
- name: FLYTE_INTERNAL_TASK_PROJECT
value: my-project
- name: FLYTE_INTERNAL_TASK_DOMAIN
value: development
- name: FLYTE_INTERNAL_TASK_NAME
value: app.timed_task
- name: FLYTE_INTERNAL_TASK_VERSION
value: Q2f7IDWJG7-hRFbRNnsC6A
- name: FLYTE_INTERNAL_PROJECT
value: my-project
- name: FLYTE_INTERNAL_DOMAIN
value: development
- name: FLYTE_INTERNAL_NAME
value: app.timed_task
- name: FLYTE_INTERNAL_VERSION
value: Q2f7IDWJG7-hRFbRNnsC6A
- name: FLYTE_AWS_SECRET_ACCESS_KEY
value: miniostorage
- name: FLYTE_AWS_ENDPOINT
value: <http://flyte-sandbox-minio.flyte:9000>
- name: FLYTE_AWS_ACCESS_KEY_ID
value: minio
image: <http://cr.flyte.org/flyteorg/flytekit:py3.11-1.10.7|cr.flyte.org/flyteorg/flytekit:py3.11-1.10.7>
imagePullPolicy: IfNotPresent
name: fc200e7ff601b48c2840-n1-0
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-wj5zn
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
nodeName: 8d60e8d92d1d
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: <http://node.kubernetes.io/not-ready|node.kubernetes.io/not-ready>
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: <http://node.kubernetes.io/unreachable|node.kubernetes.io/unreachable>
operator: Exists
tolerationSeconds: 300
volumes:
- name: kube-api-access-wj5zn
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2024-05-26T08:22:41Z"
reason: PodCompleted
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2024-05-26T08:23:11Z"
reason: PodCompleted
status: "False"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2024-05-26T08:23:11Z"
reason: PodCompleted
status: "False"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2024-05-26T08:22:41Z"
status: "True"
type: PodScheduled
containerStatuses:
- containerID: <containerd://8d8057c8073021afe196cb95cd7ea80fd5b0e7bc80c1bf02f83f4f70b31e0ea>6
image: <http://cr.flyte.org/flyteorg/flytekit:py3.11-1.10.7|cr.flyte.org/flyteorg/flytekit:py3.11-1.10.7>
imageID: <http://cr.flyte.org/flyteorg/flytekit@sha256:3f3d95c825a1ed4caf328422e77846853afc2da8c9201f312b57a92e085ed643|cr.flyte.org/flyteorg/flytekit@sha256:3f3d95c825a1ed4caf328422e77846853afc2da8c9201f312b57a92e085ed643>
lastState: {}
name: fc200e7ff601b48c2840-n1-0
ready: false
restartCount: 0
started: false
state:
terminated:
containerID: <containerd://8d8057c8073021afe196cb95cd7ea80fd5b0e7bc80c1bf02f83f4f70b31e0ea>6
exitCode: 0
finishedAt: "2024-05-26T08:23:10Z"
reason: Completed
startedAt: "2024-05-26T08:22:42Z"
hostIP: 172.17.0.2
phase: Succeeded
podIP: 10.42.0.174
podIPs:
- ip: 10.42.0.174
qosClass: Guaranteed
startTime: "2024-05-26T08:22:41Z"
freezing-airport-6809
glamorous-rainbow-77959
05/27/2024, 7:21 AMglamorous-rainbow-77959
05/27/2024, 7:46 AMsleep
workflow exampleclever-exabyte-82294
05/27/2024, 7:55 AMglamorous-rainbow-77959
05/27/2024, 1:18 PM{"asctime": "2024-05-27 12:29:28,492", "name": "flytekit", "levelname": "INFO", "message": "Registering an agent for task type: sensor, name: Sensor"}
{"asctime": "2024-05-27 12:29:33,285", "name": "flytekit", "levelname": "INFO", "message": "Getting <s3://s3-flyte-dev/flyte-pai/development/QXUM4TQWNYYGP6QNEF2O3OM43Q======/script_mode.tar.gz> to ./"}
{"asctime": "2024-05-27 12:29:35,200", "name": "flytekit", "levelname": "INFO", "message": "Download data to local from <s3://s3-flyte-dev/flyte-pai/development/QXUM4TQWNYYGP6QNEF2O3OM43Q======/script_mode.tar.gz>. [Wall Time: 3.4110170670001025s, Process Time: 0.33784325000000004s]"}
{"asctime": "2024-05-27 12:29:35,281", "name": "flytekit", "levelname": "INFO", "message": "Download distribution. [Wall Time: 3.4918792429998575s, Process Time: 0.33875893199999996s]"}
{"asctime": "2024-05-27 12:29:40,083", "name": "flytekit", "levelname": "INFO", "message": "Registering an agent for task type: sensor, name: Sensor"}
{"asctime": "2024-05-27 12:29:43,090", "name": "flytekit", "levelname": "INFO", "message": "Welcome to Flyte! Version: 1.10.7"}
{"asctime": "2024-05-27 12:29:43,091", "name": "flytekit", "levelname": "DEBUG", "message": "Running task execution with resolver flytekit.core.python_auto_container.default_task_resolver..."}
{"asctime": "2024-05-27 12:29:43,091", "name": "flytekit", "levelname": "INFO", "message": "Using user directory /tmp/flyte-n3y5a2rf/sandbox/local_flytekit/eaf508b247b34c7e40f2df0e458d669d"}
{"asctime": "2024-05-27 12:29:43,091", "name": "flytekit", "levelname": "DEBUG", "message": "Checkpointer created with source None and dest <s3://s3-flyte-dev/data/95/fda3822f0c6c04ff78be-n0-0/_flytecheckpoints>"}
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 5:31 AMfreezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 6:05 AMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 6:06 AMi think fast registration can have an overhead to run as it has to download your codeYes, that’s one thing I was thinking about
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 6:08 AMthis is why we recommend to use full containerized env for runtimeMeaning to bake in our code in the docker image? Does Flyte support this?
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
@task(interruptible=True, retries=2)
freezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 6:11 AMthis can be slow right - to get a machineYes, @freezing-airport-6809, but we are measuring the startup time only after pod was started by directly inspecting pod logs. So this startup time is excluded
glamorous-rainbow-77959
05/28/2024, 6:13 AMflytekit
before running the actual task codefreezing-airport-6809
freezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/28/2024, 6:15 AMI think fast registered might be reason, as Python startup can be slowHmm. So if we use non-fast registration this should go away? How it will affect python startup?
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
clever-exabyte-82294
05/29/2024, 11:34 AM{"asctime": "2024-05-29 05:36:45,420", "name": "flytekit", "levelname": "INFO", "message": "Using flytectl/YAML config /home/flytekit/.flyte/config.yaml"}
{"asctime": "2024-05-29 05:36:47,414", "name": "flytekit", "levelname": "INFO", "message": "Registering an agent for task type: sensor, name: Sensor"}
{"asctime": "2024-05-29 05:36:51,011", "name": "flytekit", "levelname": "INFO", "message": "Welcome to Flyte! Version: 1.10.7"}
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/29/2024, 1:47 PMfreezing-airport-6809
freezing-airport-6809
glamorous-rainbow-77959
05/29/2024, 1:52 PMfreezing-airport-6809
clever-exabyte-82294
05/29/2024, 1:52 PM{"asctime": "2024-05-29 05:36:51,015", "name": "flytekit", "levelname": "DEBUG", "message": "Switch storage.connection.secret-key could not be found in yaml config"}
{"asctime": "2024-05-29 05:36:54,216", "name": "flytekit", "levelname": "DEBUG", "message": "\t\t[2] Pushing context - execute, branch[False], StackOrigin(setup_execution, 299, /usr/local/lib/python3.11/site-packages/flytekit/bin/entrypoint.py)"}
{"asctime": "2024-05-29 05:36:54,312", "name": "flytekit", "levelname": "DEBUG", "message": "Task returns unnamed native tuple <class 'dict'>"}
freezing-airport-6809
glamorous-carpet-83516
05/30/2024, 4:04 PMfreezing-airport-6809
freezing-airport-6809
clever-exabyte-82294
05/31/2024, 4:38 AMfreezing-airport-6809
freezing-airport-6809
clever-exabyte-82294
05/31/2024, 11:05 AMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809
clever-exabyte-82294
05/31/2024, 6:36 PMtalk gas a lot of imports?didn't understand this.
freezing-airport-6809
glamorous-rainbow-77959
06/20/2024, 12:03 PMfreezing-airport-6809
clever-exabyte-82294
06/20/2024, 2:36 PMfreezing-airport-6809
clever-exabyte-82294
06/25/2024, 8:19 AM