-
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.
Split create_stage out of dvcfile to Stage::create() and overwrite
- Loading branch information
Showing
6 changed files
with
48 additions
and
52 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
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,22 +1,29 @@ | ||
import logging | ||
|
||
from . import locked | ||
from .scm_context import scm_context | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@locked | ||
@scm_context | ||
def run(self, no_exec=False, **kwargs): | ||
from dvc.stage import Stage | ||
from dvc.dvcfile import Dvcfile | ||
|
||
stage = Dvcfile.create_stage(self, **kwargs) | ||
|
||
if stage is None: | ||
stage = Stage.create(self, **kwargs) | ||
if not stage: | ||
return None | ||
|
||
dvcfile = Dvcfile(self, stage.path) | ||
dvcfile.overwrite_with_prompt(force=kwargs.get("overwrite", True)) | ||
|
||
self.check_modified_graph([stage]) | ||
|
||
if not no_exec: | ||
stage.run(no_commit=kwargs.get("no_commit", False)) | ||
|
||
Dvcfile(self, stage.path).dump(stage) | ||
dvcfile.dump(stage) | ||
|
||
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