phil
01/10/2023, 3:42 PMJeff Hale
01/10/2023, 4:08 PMphil
01/10/2023, 4:43 PMJeff Hale
01/11/2023, 1:37 AMphil
03/22/2023, 2:46 AMjpuris
03/22/2023, 6:25 AMphil
03/22/2023, 7:00 AMJeff Hale
03/22/2023, 1:59 PMphil
03/22/2023, 2:21 PMChristopher Boyd
03/23/2023, 1:48 PMapiVersion: batch/v1
kind: Job
metadata:
# labels are required, even if empty
labels: {}
namespace: prefect2
spec:
template:
spec:
completions: 1
containers: # the first container is required
- env: [] # env is required, even if empty
name: prefect-job
tolerations:
- key: "example-key"
operator: "Exists"
effect: "NoSchedule"
parallelism: 1
restartPolicy: Never
phil
03/23/2023, 5:57 PMChristopher Boyd
03/23/2023, 6:06 PMk8s_job = KubernetesJob(
image=image,
namespace="prefect2",
name=environ['PROJECT_NAME'],
customizations=customizations,
env=dict(
GCP_PROJECT_ID=GCP_PROJECT_ID,
GCP_RESULTS_BUCKET=GCP_RESULTS_BUCKET,
PREFECT_VERSION=PREFECT_VERSION,
PYTHON_VERSION=PYTHON_VERSION
),
labels={"environment": f'{environment}'.lower()},
finished_job_ttl=600,
job_watch_timeout_seconds=600,
service_account_name=prefect2-agent
)
phil
03/23/2023, 6:19 PMChristopher Boyd
03/23/2023, 6:27 PMspec:
template:
spec:
completions: 1
containers: # the first container is required
- env: [] # env is required, even if empty
name: prefect-job
tolerations:
- key: "example-key"
operator: "Exists"
effect: "NoSchedule"
{
"op": "add",
"path": "/spec/template/spec",
"value": {
"tolerations": [
{
"key": "example-key",
"operator": "Exists",
"effect": "NoSchedule"
}
]
}
}
phil
03/23/2023, 6:48 PMChristopher Boyd
03/23/2023, 7:28 PM{
"kind": "Job",
"spec": {
"template": {
"spec": {
"containers": [
{
"env": [],
"name": "prefect-job"
}
],
"completions": 1,
"parallelism": 1,
"tolerations": [
{
"key": "prefect",
"value": "regular",
"effect": "NoSchedule",
"operator": "Equal"
}
],
"nodeSelector": {
"prefect": "regular"
},
"restartPolicy": "Never"
}
}
},
"metadata": {
"labels": {}
},
"apiVersion": "batch/v1"
}
customizations = [
{
"op": "add",
"path": "/spec/template/spec",
"value": {
"tolerations": [
{
"key": "example-key",
"operator": "Exists",
"effect": "NoSchedule"
},
]
},
}
]
KubernetesJob(
...
customizations=customizations
)
phil
03/23/2023, 7:51 PM