Skip to content

Commit 21310f9

Browse files
authored
Merge pull request dask#56 from halfdanrump/master
Adds option to use preemptible instances
2 parents b940c44 + 6a29856 commit 21310f9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

dask_kubernetes/cli/defaults.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cluster:
66
autoscaling: False
77
min_nodes: 2
88
max_nodes: 32
9+
preemptible: False
910
jupyter:
1011
memory: 4096Mi
1112
cpus: 1

dask_kubernetes/cli/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ def create(ctx, name, settings_file, set, nowait):
7272
max=conf['cluster']['max_nodes']))
7373
else:
7474
autoscaling = ''
75+
if conf['cluster']['preemptible']:
76+
preemptible = '--preemptible'
77+
else:
78+
preemptible = ''
7579
call("gcloud container clusters create {0} --num-nodes {1} --machine-type"
76-
" {2} --no-async --disk-size {3} {autoscaling} --tags=dask --scopes "
80+
" {2} --no-async --disk-size {3} {autoscaling} {preemptible} --tags=dask --scopes "
7781
"https://www.googleapis.com/auth/cloud-platform".format(
7882
name, conf['cluster']['num_nodes'], conf['cluster']['machine_type'],
7983
conf['cluster']['disk_size'],
80-
autoscaling=autoscaling))
84+
autoscaling=autoscaling,
85+
preemptible=preemptible))
8186
get_credentials(name)
8287
context = get_context_from_cluster(name)
8388
# specify label for notebook and scheduler

0 commit comments

Comments
 (0)