@@ -271,7 +271,7 @@ def filter_pipeline(stages):
271271 # - if run without --reset, the checkpoint out will be checked out
272272 # using any hash present in dvc.lock (or removed if no entry
273273 # exists in dvc.lock)
274- checkpoint_reset = kwargs .pop ("reset" , False )
274+ checkpoint_reset : bool = kwargs .pop ("reset" , False )
275275 dvc_checkout (
276276 dvc ,
277277 targets = targets ,
@@ -283,7 +283,10 @@ def filter_pipeline(stages):
283283 )
284284
285285 checkpoint_func = partial (
286- cls .checkpoint_callback , dvc .scm , name , repro_force
286+ cls .checkpoint_callback ,
287+ dvc .scm ,
288+ name ,
289+ repro_force or checkpoint_reset ,
287290 )
288291 stages = dvc_reproduce (
289292 dvc ,
@@ -295,12 +298,18 @@ def filter_pipeline(stages):
295298
296299 exp_hash = cls .hash_exp (stages )
297300 try :
301+ is_checkpoint = any (stage .is_checkpoint for stage in stages )
302+ if is_checkpoint and checkpoint_reset :
303+ # For reset checkpoint stages, we need to force overwriting
304+ # existing checkpoint refs even though repro may not have
305+ # actually been run with --force
306+ repro_force = True
298307 cls .commit (
299308 dvc .scm ,
300309 exp_hash ,
301310 exp_name = name ,
302311 force = repro_force ,
303- checkpoint = any ( stage . is_checkpoint for stage in stages ) ,
312+ checkpoint = is_checkpoint ,
304313 )
305314 except UnchangedExperimentError :
306315 pass
0 commit comments