ancient-wolf-19325
06/12/2024, 8:33 AMrestartPolicy being removed from the sidecar container likely stems from the way the Flyte PyTorch plugin or the Kubeflow training operator handles the pod specification.
To debug this, you can start by examining the Flyte PyTorch plugin's code to see how it processes and converts the pod spec into a PyTorchJob resource. Specifically, you should look at the OverridePrimaryContainerName and ParseRestartPolicy functions in the Flyte plugin code, as these functions handle container and restart policy configurations.
Here is a relevant snippet from the Flyte plugin code that shows how the restart policy is parsed and applied:
// ParseRestartPolicy converts a Flyte restart policy to a k8s restart policy.
func ParseRestartPolicy(flyteRestartPolicy kfplugins.RestartPolicy) commonOp.RestartPolicy {
restartPolicyMap := map[kfplugins.RestartPolicy]commonOp.RestartPolicy{
kfplugins.RestartPolicy_RESTART_POLICY_NEVER: commonOp.RestartPolicyNever,
kfplugins.RestartPolicy_RESTART_POLICY_ON_FAILURE: commonOp.RestartPolicyOnFailure,
kfplugins.RestartPolicy_RESTART_POLICY_ALWAYS: commonOp.RestartPolicyAlways,
}
return restartPolicyMap[flyteRestartPolicy]
}
Additionally, you can check the OverridePrimaryContainerName function to see if it modifies the container names or other properties:
func OverridePrimaryContainerName(podSpec *v1.PodSpec, primaryContainerName string, defaultContainerName string) {
for idx, c := range podSpec.Containers {
if c.Name == primaryContainerName {
podSpec.Containers[idx].Name = defaultContainerName
return
}
}
}
To find out how your pod spec is being converted into a PyTorchJob, you can look at the BuildResource function in the Flyte plugin, which constructs the PyTorchJob resource from the task template and pod spec:
```
```ancient-wolf-19325
06/12/2024, 8:33 AM>>```res, err := pytorchResourceHandler.BuildResource(context.TODO(), dummyPytorchTaskContext(taskTemplate, resourceRequirements, nil, "")) ``` For more detailed debugging, you can add logging statements in these functions to print out the pod spec and
PyTorchJob resource at various stages of the conversion process.
Would you like more detailed guidance on how to modify or debug these specific parts of the Flyte plugin code?
Sources:
- https://docs.flyte.org/en/latest/_modules/flytekitplugins/kftensorflow/task.html
- https://docs.flyte.org/en/latest/_modules/flytekitplugins/kfmpi/task.html
Slack Link
https://flyte-org.slack.com/archives/CP2HDHKE1/p1718181188.682099 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.