|
3 | 3 | import subprocess |
4 | 4 | import sys |
5 | 5 | import time |
6 | | -from pathlib import Path, PurePosixPath |
| 6 | +from pathlib import Path |
7 | 7 | from typing import Dict, List, Optional, Set, TypeVar |
8 | 8 |
|
9 | 9 | import gpuhunt |
|
33 | 33 | ) |
34 | 34 | from dstack._internal.core.models.common import ApplyAction, RegistryAuth |
35 | 35 | from dstack._internal.core.models.configurations import ( |
36 | | - LEGACY_REPO_DIR, |
37 | 36 | AnyRunConfiguration, |
38 | 37 | ApplyConfigurationType, |
39 | 38 | ConfigurationWithCommandsParams, |
|
57 | 56 | get_repo_creds_and_default_branch, |
58 | 57 | load_repo, |
59 | 58 | ) |
60 | | -from dstack._internal.settings import FeatureFlags |
61 | 59 | from dstack._internal.utils.common import local_time |
62 | 60 | from dstack._internal.utils.interpolator import InterpolatorError, VariablesInterpolator |
63 | 61 | from dstack._internal.utils.logging import get_logger |
@@ -95,48 +93,8 @@ def apply_configuration( |
95 | 93 | self.validate_gpu_vendor_and_image(conf) |
96 | 94 | self.validate_cpu_arch_and_image(conf) |
97 | 95 |
|
98 | | - working_dir = conf.working_dir |
99 | | - if working_dir is None: |
100 | | - # Use the default working dir for the image for tasks and services if `commands` |
101 | | - # is not set (emulate pre-0.19.27 JobConfigutor logic), otherwise fall back to |
102 | | - # `/workflow`. |
103 | | - if not FeatureFlags.LEGACY_REPO_DIR_DISABLED and ( |
104 | | - isinstance(conf, DevEnvironmentConfiguration) or conf.commands |
105 | | - ): |
106 | | - # relative path for compatibility with pre-0.19.27 servers |
107 | | - conf.working_dir = "." |
108 | | - warn( |
109 | | - f'The [code]working_dir[/code] is not set — using legacy default [code]"{LEGACY_REPO_DIR}"[/code].' |
110 | | - " Future versions will default to the [code]image[/code]'s working directory." |
111 | | - ) |
112 | | - elif not is_absolute_posix_path(working_dir): |
113 | | - if FeatureFlags.LEGACY_REPO_DIR_DISABLED: |
114 | | - raise ConfigurationError("`working_dir` must be absolute") |
115 | | - legacy_working_dir = PurePosixPath(LEGACY_REPO_DIR) / working_dir |
116 | | - warn( |
117 | | - "[code]working_dir[/code] is relative." |
118 | | - f" Using legacy working directory [code]{legacy_working_dir}[/code]\n\n" |
119 | | - "Future versions will require absolute path\n" |
120 | | - f"To keep using legacy working directory, set" |
121 | | - f" [code]working_dir[/code] to [code]{legacy_working_dir}[/code]\n" |
122 | | - ) |
123 | | - else: |
124 | | - # relative path for compatibility with pre-0.19.27 servers |
125 | | - try: |
126 | | - conf.working_dir = str(PurePosixPath(working_dir).relative_to(LEGACY_REPO_DIR)) |
127 | | - except ValueError: |
128 | | - pass |
129 | | - |
130 | | - if conf.repos and conf.repos[0].path is None: |
131 | | - if FeatureFlags.LEGACY_REPO_DIR_DISABLED: |
132 | | - raise ConfigurationError("`repos[0].path` is not set") |
133 | | - warn( |
134 | | - "[code]repos[0].path[/code] is not set," |
135 | | - f" using legacy repo path [code]{LEGACY_REPO_DIR}[/code]\n\n" |
136 | | - "In a future version the default value will be changed." |
137 | | - f" To keep using [code]{LEGACY_REPO_DIR}[/code], explicitly set" |
138 | | - f" [code]repos[0].path[/code] to [code]{LEGACY_REPO_DIR}[/code]\n" |
139 | | - ) |
| 96 | + if conf.working_dir is not None and not is_absolute_posix_path(conf.working_dir): |
| 97 | + raise ConfigurationError("working_dir must be absolute") |
140 | 98 |
|
141 | 99 | config_manager = ConfigManager() |
142 | 100 | repo = self.get_repo(conf, configuration_path, configurator_args, config_manager) |
|
0 commit comments