-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use repo.stage.create_from_cli to create stages (#5281)
- Loading branch information
Showing
7 changed files
with
65 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,36 @@ | ||
from typing import TYPE_CHECKING | ||
from typing import TYPE_CHECKING, Union | ||
|
||
from . import locked | ||
from .scm_context import scm_context | ||
|
||
if TYPE_CHECKING: | ||
from dvc.stage import PipelineStage, Stage | ||
|
||
from . import Repo | ||
|
||
|
||
@locked | ||
@scm_context | ||
def run( | ||
self: "Repo", | ||
fname: str = None, | ||
no_exec: bool = False, | ||
single_stage: bool = False, | ||
no_commit: bool = False, | ||
run_cache: bool = True, | ||
force: bool = True, | ||
**kwargs | ||
): | ||
from dvc.stage.utils import check_graphs, create_stage_from_cli | ||
|
||
stage = create_stage_from_cli( | ||
self, single_stage=single_stage, fname=fname, **kwargs | ||
) | ||
) -> Union["Stage", "PipelineStage", None]: | ||
from dvc.stage.utils import validate_state | ||
|
||
if kwargs.get("run_cache", True) and stage.can_be_skipped: | ||
stage = self.stage.create_from_cli(**kwargs) | ||
if run_cache and stage.can_be_skipped: | ||
return None | ||
|
||
check_graphs(self, stage, force=kwargs.get("force", True)) | ||
validate_state(self, stage, force=force) | ||
|
||
if no_exec: | ||
stage.ignore_outs() | ||
else: | ||
stage.run( | ||
no_commit=kwargs.get("no_commit", False), | ||
run_cache=kwargs.get("run_cache", True), | ||
) | ||
stage.run(no_commit=no_commit, run_cache=run_cache) | ||
|
||
stage.dump(update_lock=not no_exec) | ||
return stage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters