Skip to content

Commit f0b70a6

Browse files
authored
feat: remove dry_run arg from run_commands (#660)
1 parent b1637d4 commit f0b70a6

File tree

6 files changed

+6
-18
lines changed

6 files changed

+6
-18
lines changed

src/xpk/commands/workload.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,6 @@ def workload_delete(args) -> None:
732732
'Delete Workload',
733733
task_names,
734734
batch=100,
735-
dry_run=args.dry_run,
736735
)
737736

738737
if return_code != 0:

src/xpk/core/commands.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
from ..utils.execution_context import is_dry_run
2727

2828

29-
def run_commands(commands, jobname, per_command_name, batch=10, dry_run=False):
29+
def run_commands(commands, jobname, per_command_name, batch=10):
3030
"""Run commands in groups of `batch`.
3131
3232
Args:
3333
commands: list of command.
3434
jobname: the name of the job.
3535
per_command_name: list of command names.
3636
batch: number of commands to run in parallel.
37-
dry_run: enables dry_run if set to true.
3837
3938
Returns:
4039
0 if successful and 1 otherwise.
@@ -47,7 +46,7 @@ def run_commands(commands, jobname, per_command_name, batch=10, dry_run=False):
4746
f'Breaking up a total of {len(commands)} commands into'
4847
f' {len(commands_batched)} batches'
4948
)
50-
if dry_run:
49+
if is_dry_run():
5150
xpk_print('Pretending all the jobs succeeded')
5251
return 0
5352

src/xpk/core/nap.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def enable_autoprovisioning_on_cluster(
156156
commands,
157157
'Update node pools with autoprovisioning support',
158158
task_names,
159-
dry_run=args.dry_run,
160159
)
161160
if max_return_code != 0:
162161
xpk_print(

src/xpk/core/nodepool.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ def run_gke_node_pool_create_command(
212212
delete_commands,
213213
'Delete Nodepools',
214214
delete_task_names,
215-
dry_run=args.dry_run,
216215
)
217216
if max_return_code != 0:
218217
xpk_print(f'Delete Nodepools returned ERROR {max_return_code}')
@@ -240,7 +239,6 @@ def run_gke_node_pool_create_command(
240239
update_WI_commands,
241240
'Enable Workload Identity on existing Nodepools',
242241
update_WI_task_names,
243-
dry_run=args.dry_run,
244242
)
245243
if max_return_code != 0:
246244
xpk_print(
@@ -265,9 +263,7 @@ def run_gke_node_pool_create_command(
265263
)
266264
configmap_yml = {}
267265
configmap_yml[resources_configmap_name] = resources_yml
268-
return_code = create_or_update_cluster_configmap(
269-
configmap_yml, args.dry_run
270-
)
266+
return_code = create_or_update_cluster_configmap(configmap_yml)
271267
if return_code != 0:
272268
return 1
273269

@@ -369,7 +365,6 @@ def run_gke_node_pool_create_command(
369365
create_commands,
370366
'Create Nodepools',
371367
create_task_names,
372-
dry_run=args.dry_run,
373368
)
374369
if max_return_code != 0:
375370
xpk_print(f'Create Nodepools returned ERROR {max_return_code}')
@@ -582,7 +577,6 @@ def upgrade_gke_nodepools_version(args, default_rapid_gke_version) -> int:
582577
commands,
583578
'Update GKE node pools to default RAPID GKE version',
584579
task_names,
585-
dry_run=args.dry_run,
586580
)
587581
if max_return_code != 0:
588582
xpk_print(

src/xpk/core/pathways.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def try_to_delete_pathwaysjob_first(args, workloads) -> bool:
326326
return_code = run_command_with_updates(commands[0], 'Delete Workload')
327327
else:
328328
return_code = run_commands(
329-
commands, 'Delete Workload', task_names, batch=100, dry_run=args.dry_run
329+
commands, 'Delete Workload', task_names, batch=100
330330
)
331331

332332
if return_code != 0:

src/xpk/core/resources.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,10 @@ def create_cluster_configmaps(
153153
args=args, name=metadata_configmap_name, data=metadata
154154
)
155155
configmap_yml[metadata_configmap_name] = metadata_yml
156-
return create_or_update_cluster_configmap(configmap_yml, args.dry_run)
156+
return create_or_update_cluster_configmap(configmap_yml)
157157

158158

159-
def create_or_update_cluster_configmap(
160-
configmap_yml: dict, dry_run: bool
161-
) -> int:
159+
def create_or_update_cluster_configmap(configmap_yml: dict) -> int:
162160
"""
163161
Args:
164162
configmap_yml: dict containing ConfigMap name and yml string.
@@ -179,7 +177,6 @@ def create_or_update_cluster_configmap(
179177
commands,
180178
'GKE Cluster CreateOrUpdate ConfigMap(s)',
181179
task_names,
182-
dry_run=dry_run,
183180
)
184181
if return_code != 0:
185182
xpk_print(

0 commit comments

Comments
 (0)