Skip to content

Commit

Permalink
Merge pull request #205 from caracal-pipeline/issue-203b
Browse files Browse the repository at this point in the history
fixes #203
  • Loading branch information
SpheMakh authored Jan 30, 2024
2 parents 143f346 + 3d4beae commit 9a626ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions stimela/backends/kube/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class DaskCluster(object):
name: Optional[str] = None
num_workers: int = 0
threads_per_worker: int = 1
memory_limit: Optional[str] = None
worker_pod: KubePodSpec = KubePodSpec()
scheduler_pod: KubePodSpec = KubePodSpec()
forward_dashboard_port: int = 8787 # set to non-0 to forward the http dashboard to this local port
Expand Down
11 changes: 8 additions & 3 deletions stimela/backends/kube/daskjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def create_parser():
default="compute-runner",
help="The kubernetes service account which will run the job",
)
p.add_argument(
"--pull-policy",
default="Always",
help="imagePullPolicy setting for pods",
)
p.add_argument(
"-f",
"--mount-file",
Expand Down Expand Up @@ -131,7 +136,7 @@ def daskjob_template(args):
}
],
"image": args.image,
"imagePullPolicy": "IfNotPresent",
"imagePullPolicy": args.pull_policy,
"livenessProbe": {
"httpGet": {
"path": "/health",
Expand Down Expand Up @@ -184,7 +189,7 @@ def daskjob_template(args):
{"name": "WORKER_ENV", "value": "hello-world"}
],
"image": args.image,
"imagePullPolicy": "IfNotPresent",
"imagePullPolicy": args.pull_policy,
"name": "worker",
}
],
Expand All @@ -198,7 +203,7 @@ def daskjob_template(args):
"containers": [
{
"image": args.image,
"imagePullPolicy": "IfNotPresent",
"imagePullPolicy": args.pull_policy,
"name": "job",
}
],
Expand Down
4 changes: 3 additions & 1 deletion stimela/backends/kube/run_kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def dprint(level, *args):
labels=pod_labels,
namespace=namespace,
image=image_name,
memory_limit=kube.dask_cluster.worker_pod.memory and kube.dask_cluster.worker_pod.memory.limit,
pull_policy='Always' if kube.always_pull_images else 'IfNotPresent',
memory_limit=kube.dask_cluster.memory_limit if kube.dask_cluster.memory_limit is not None
else kube.dask_cluster.worker_pod.memory and kube.dask_cluster.worker_pod.memory.limit,
nworkers=kube.dask_cluster.num_workers,
threads_per_worker=kube.dask_cluster.threads_per_worker,
# cmdline=["/bin/sh", "-c", "while true;do date;sleep 5; done"],
Expand Down

0 comments on commit 9a626ba

Please sign in to comment.