MCPcopy
hub / github.com/treeverse/dvc / reproduce

Method reproduce

dvc/repo/experiments/executor/base.py:449–539  ·  view source on GitHub ↗

Run dvc repro and return the result. Returns tuple of (exp_hash, exp_ref, force) where exp_hash is the experiment hash (or None on error), exp_ref is the experiment ref, and force is a bool specifying whether or not this experiment should force overwrite

(
        cls,
        info: "ExecutorInfo",
        rev: str,
        queue: Optional["Queue"] = None,
        infofile: Optional[str] = None,
        log_errors: bool = True,
        log_level: Optional[int] = None,
        copy_paths: Optional[list[str]] = None,
        message: Optional[str] = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

447
448 @classmethod
449 def reproduce(
450 cls,
451 info: "ExecutorInfo",
452 rev: str,
453 queue: Optional["Queue"] = None,
454 infofile: Optional[str] = None,
455 log_errors: bool = True,
456 log_level: Optional[int] = None,
457 copy_paths: Optional[list[str]] = None,
458 message: Optional[str] = None,
459 **kwargs,
460 ) -> "ExecutorResult":
461 """Run dvc repro and return the result.
462
463 Returns tuple of (exp_hash, exp_ref, force) where exp_hash is the
464 experiment hash (or None on error), exp_ref is the experiment ref,
465 and force is a bool specifying whether or not this experiment
466 should force overwrite any existing duplicates.
467 """
468 from dvc.repo.checkout import checkout as dvc_checkout
469 from dvc.ui import ui
470
471 if queue is not None:
472 queue.put((rev, os.getpid()))
473
474 log_ctx = cls._set_log_level(log_level) if log_errors else nullcontext()
475
476 exp_hash: Optional[str] = None
477 exp_ref: Optional[ExpRefInfo] = None
478 repro_force: bool = False
479
480 if info.name:
481 ui.write(f"Reproducing experiment '{info.name}'")
482
483 with (
484 log_ctx,
485 cls._repro_dvc(
486 info,
487 infofile,
488 log_errors=log_errors,
489 copy_paths=copy_paths,
490 message=message,
491 **kwargs,
492 ) as dvc,
493 ):
494 args, kwargs = cls._repro_args(dvc)
495 if args:
496 targets: Optional[Union[list, str]] = args[0]
497 else:
498 targets = kwargs.get("targets")
499
500 repro_force = kwargs.get("force", False)
501 logger.trace("Executor repro with force = '%s'", str(repro_force))
502
503 repro_dry = kwargs.get("dry")
504
505 if not repro_dry:
506 dvc_checkout(

Callers

nothing calls this directly

Calls 11

add_no_submodulesFunction · 0.90
ExecutorResultClass · 0.85
_set_log_levelMethod · 0.80
writeMethod · 0.80
_repro_dvcMethod · 0.80
_repro_argsMethod · 0.80
_get_top_level_pathsMethod · 0.80
hash_expMethod · 0.80
_repro_commitMethod · 0.80
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected