ancient-wolf-19325
06/14/2024, 6:56 AMtask_resource_defaults:
task_resources:
defaults:
cpu: 250m
memory: 2Gi
limits:
cpu: 5000m
memory: 64Gi
Here’s what I’ve done so far:
• Set a low default memory request and a high memory limit in task_resource_defaults.
• Observed that changing the defaults in task_resource_defaults affects the memory available to the pods.
• Observed that changing the requests and limits in the task decorator (inside or outside the limits of task_resource_defaults) affects nothing.
I have been checking the memory available for the pod with kubectl describe pod/node where it always shows the requests and limist as the exact same as the defaults in task_resource_defaults. Also, when the memory usage of the pod goes over the limit I get OOMKilled.
For some reason the Flyte task decorator seem to be ignored, and only the defaults are applied. Could anyone help me understand what might be missing or misconfigured? Any insights or suggestions would be greatly appreciated!
# Answer
It seems like the issue is that the task resource settings specified in the Flyte task decorator are not being applied, and only the defaults from task_resource_defaults are being used. This can happen due to several reasons, including misconfiguration or the way Flyte handles resource requests and limits.
Steps to Diagnose and Fix:
1. Verify Configuration Application:
Ensure that the configuration changes in values.yaml are correctly applied to the Flyte cluster. After modifying the configuration file, apply the changes using the appropriate Helm command:
helm upgrade --install flyte-core flyteorg/flyte-core -f values.yaml
2. Check Task Resource Overrides:
Ensure that the task resource settings in the task decorator are correctly specified. Here’s an example of how to set requests and limits in the task decorator:
from flytekit import task, Resources
@task(requests=Resources(cpu="500m", mem="4Gi"), limits=Resources(cpu="1000m", mem="8Gi"))
def my_task():
# Task implementation
pass
3. Inspect Pod Resource Allocation:
After deploying the workflow, inspect the actual resource allocation of the task pod using `kubectl describe pod`:
kubectl describe pod <pod-name> -n <namespace>
Check the spec.containers.resources section to see if the requests and limits match what you specified in the task decorator.
4. FlyteAdmin Configuration:ancient-wolf-19325
06/14/2024, 6:56 AM>>Ensure that FlyteAdmin is correctly configured to read the updated configuration. Sometimes, FlyteAdmin service may need to be restarted for the changes to take effect:
kubectl rollout restart deployment flyteadmin -n <namespace>
5. Check for Overrides at Task Registration:
Task definitions can specify their own resource requirements, which override the defaults. Ensure that the task definitions are not being overridden by other configurations.
6. Flyte Version Compatibility:
Ensure that the version of Flyte you are using supports the configuration overrides as expected. There might be differences in how different versions handle resource configurations.
Example Configuration in `values.yaml`:
task_resource_defaults:
task_resources:
defaults:
cpu: 250m
memory: 2Gi
limits:
cpu: 5000m
memory: 64Gi
Example Task Definition:
from flytekit import task, Resources
@task(requests=Resources(cpu="500m", mem="4Gi"), limits=Resources(cpu="1000m", mem="8Gi"))
def my_task():
# Task implementation
pass
Additional Resources:
- Flyte Documentation on Task Resources
- GitHub Issue on Task Resource Configuration
Would you like more detailed steps or further assistance on any specific part of the configuration?
Sources:
- Flyte Documentation on Task Resources
- GitHub Issue on Task Resource Configuration
Slack Link
https://flyte-org.slack.com/archives/CP2HDHKE1/p1718348193.054599 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.