Skip to content

Commit

Permalink
Move EXEC_TMP_DIR and EXEC_PID_DIR to experiment.utils
Browse files Browse the repository at this point in the history
  • Loading branch information
karajan1001 committed Nov 28, 2022
1 parent 6a75f3c commit 5fa33a0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
4 changes: 0 additions & 4 deletions dvc/repo/experiments/executor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
logger = logging.getLogger(__name__)


EXEC_TMP_DIR = "exps"
EXEC_PID_DIR = "run"


class ExecutorResult(NamedTuple):
exp_hash: Optional[str]
ref_info: Optional["ExpRefInfo"]
Expand Down
3 changes: 2 additions & 1 deletion dvc/repo/experiments/executor/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
EXEC_MERGE,
EXEC_NAMESPACE,
)
from .base import EXEC_TMP_DIR, BaseExecutor, TaskStatus
from ..utils import EXEC_TMP_DIR
from .base import BaseExecutor, TaskStatus

if TYPE_CHECKING:
from scmrepo.git import Git
Expand Down
9 changes: 2 additions & 7 deletions dvc/repo/experiments/queue/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@
from dvc.ui import ui

from ..exceptions import CheckpointExistsError, ExperimentExistsError
from ..executor.base import (
EXEC_PID_DIR,
EXEC_TMP_DIR,
BaseExecutor,
ExecutorResult,
)
from ..executor.base import BaseExecutor, ExecutorResult
from ..executor.local import WorkspaceExecutor
from ..refs import ExpRefInfo
from ..stash import ExpStash, ExpStashEntry
from ..utils import exp_refs_by_rev, scm_locked
from ..utils import EXEC_PID_DIR, EXEC_TMP_DIR, exp_refs_by_rev, scm_locked

if TYPE_CHECKING:
from scmrepo.git import Git
Expand Down
3 changes: 2 additions & 1 deletion dvc/repo/experiments/queue/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from dvc.ui import ui

from ..exceptions import UnresolvedQueueExpNamesError
from ..executor.base import EXEC_TMP_DIR, ExecutorInfo, ExecutorResult
from ..executor.base import ExecutorInfo, ExecutorResult
from ..utils import EXEC_TMP_DIR
from .base import BaseStashQueue, QueueDoneResult, QueueEntry, QueueGetResult
from .exceptions import CannotKillTasksError
from .tasks import run_exp
Expand Down
3 changes: 1 addition & 2 deletions dvc/repo/experiments/queue/tempdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

from ..exceptions import ExpQueueEmptyError
from ..executor.base import (
EXEC_PID_DIR,
EXEC_TMP_DIR,
BaseExecutor,
ExecutorInfo,
ExecutorResult,
TaskStatus,
)
from ..executor.local import TempDirExecutor
from ..utils import EXEC_PID_DIR, EXEC_TMP_DIR
from .base import BaseStashQueue, QueueEntry, QueueGetResult
from .utils import fetch_running_exp_from_temp_dir
from .workspace import WorkspaceQueue
Expand Down
3 changes: 3 additions & 0 deletions dvc/repo/experiments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
ExpRefInfo,
)

EXEC_TMP_DIR = "exps"
EXEC_PID_DIR = "run"


def scm_locked(f):
# Lock the experiments workspace so that we don't try to perform two
Expand Down
8 changes: 5 additions & 3 deletions tests/func/experiments/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@

from dvc.cli import main
from dvc.repo.experiments.executor.base import (
EXEC_PID_DIR,
EXEC_TMP_DIR,
BaseExecutor,
ExecutorInfo,
TaskStatus,
)
from dvc.repo.experiments.queue.base import QueueEntry
from dvc.repo.experiments.refs import CELERY_STASH, ExpRefInfo
from dvc.repo.experiments.utils import exp_refs_by_rev
from dvc.repo.experiments.utils import (
EXEC_PID_DIR,
EXEC_TMP_DIR,
exp_refs_by_rev,
)
from dvc.utils import relpath
from dvc.utils.fs import makedirs
from dvc.utils.serialize import YAMLFileCorruptedError
Expand Down

0 comments on commit 5fa33a0

Please sign in to comment.