Eric
10/27/2023, 4:21 PMNate
10/27/2023, 4:28 PMEric
10/27/2023, 4:29 PMEric
10/27/2023, 5:57 PMNate
10/27/2023, 5:58 PMEric
10/27/2023, 6:07 PMNate
10/27/2023, 6:25 PMprefect.yaml
examples of people altering the spec in the exact way you're planning on, but it shouldnt be meaningfully different from the examples in that other thread in terms of how to accomplish a spec override
relevant k8s docsEric
10/27/2023, 6:26 PMdeployments:
- name: <>
tags: *common_tags
schedule: null
entrypoint: <>
work_pool: *common_work_pool
run_config:
type: "kubernetes"
job_template_path: "./kube_prefect_job_template.yaml"
And my kube_prefect_job_template.yaml
looks like
apiVersion: batch/v1
kind: Job
metadata:
generateName: flow-run-
spec:
template:
spec:
nodeSelector:
"kube/nodetype": "asyncjobs"
tolerations:
- key: "dedicated"
operator: "Equal"
value: "asyncjobs"
effect: "NoSchedule"
But these values are not getting picked up by the new pods; im not sure where prefect holds these valuesNate
10/27/2023, 6:28 PMEric
10/27/2023, 6:30 PMNate
10/27/2023, 6:33 PMdeployments:
- name: <>
tags: *common_tags
schedule: null
entrypoint: <>
work_pool: *common_work_pool
job_variables:
job_manifest:
spec:
containers:
# whatever you want to do to the spec
Eric
10/27/2023, 6:33 PMEric
10/27/2023, 6:37 PM{
"env": {
<>
},
"image": <>
"job_manifest": {
"spec": {
"tolerations": [
{
"key": "dedicated",
"value": "asyncjobs",
"effect": "NoSchedule",
"operator": "Equal"
}
],
"nodeSelector": {
"kube/nodetype": "asyncjobs"
}
}
}
}
But the jobs created still don't have those values propagatedNate
10/27/2023, 6:38 PMk describe your-pod
and see whats going on thereEric
10/27/2023, 6:42 PMNode-Selectors: <none>
Tolerations: <http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute> op=Exists for 300s
<http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute> op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 21s default-scheduler 0/4 nodes are available: 2 node(s) had untolerated taint {dedicated: asyncjobs}, 2 node(s) had untolerated taint {dedicated: webapp}. preemption: 0/4 nodes are available: 4 Preemption is not helpful for scheduling..
You can see node selectors and tolerations are not being propagated from the deployment job argumentsEric
10/27/2023, 6:55 PM"job_manifest": {
"spec": {
"template": {
"spec": {
"tolerations": [
{
"key": "dedicated",
"value": "asyncjobs",
"effect": "NoSchedule",
"operator": "Equal"
}
],
"nodeSelector": {
"kube/nodetype": "asyncjobs"
}
}
}
}
}
Eric
10/27/2023, 6:57 PMJamie Zieziula
10/27/2023, 7:04 PMprefect worker
deployment or the flow
pods?Eric
10/27/2023, 7:06 PMEric
10/27/2023, 7:06 PMNate
10/27/2023, 7:08 PMprefect.yaml
(which overrides it for each deployment)Jamie Zieziula
10/27/2023, 7:08 PMEric
10/27/2023, 7:11 PMyou can set resource requests on your k8s work pool as a default in the advanced tab in the UI (picture attached) or you could override those defaults for a given deployment in your prefect.yaml like
I read this, and added it to my deployment prefect.yaml
fileJamie Zieziula
10/27/2023, 7:13 PM"job_manifest": {
"spec": {
"template": {
"spec": {
"tolerations": [
{
"key": "dedicated",
"value": "asyncjobs",
"effect": "NoSchedule",
"operator": "Equal"
}
],
"nodeSelector": {
"kube/nodetype": "asyncjobs"
}
}
}
}
}
Nate
10/27/2023, 7:13 PMI read this, and added it to my deploymentthat's one option, but by putting that config in yourfileprefect.yaml
prefect.yaml
you're saying "i want this job spec for this specific deployment" not "all flow runs from the work pool"
if you want this spec for all flow runs from this deployment, you should put it directly on the work poolEric
10/27/2023, 7:14 PMdefinitions:
tags: &common_tags
- "feedback-insight"
- "dev"
work_pool: &common_work_pool
name: $PREFECT_WORK_POOL_NAME
job_variables:
image: $BACKEND_IMAGE_URI
env:
<>
job_manifest:
spec:
template:
spec:
tolerations:
- key: "dedicated"
operator: "Equal"
value: "asyncjobs"
effect: "NoSchedule"
nodeSelector:
"kube/nodetype": "asyncjobs"
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: "parse-feedback-dev"
tags: *common_tags
schedule: null
entrypoint: "inari_app/processing/feedback/feedback_parse_prefect.py:parse_feedback_and_highlights"
work_pool: *common_work_pool
Nate
10/27/2023, 7:14 PMEric
10/27/2023, 7:15 PMJamie Zieziula
10/27/2023, 7:15 PM