MCPcopy Create free account
hub / github.com/apache/tvm / docker

Function docker

tests/scripts/ci.py:150–231  ·  view source on GitHub ↗

Invoke a set of bash scripts through docker/bash.sh name: container name image: docker image name scripts: list of bash commands to run env: environment to set

(
    name: str,
    image: str,
    scripts: list[str],
    env: dict[str, str],
    interactive: bool,
    additional_flags: dict[str, str] | None = None,
)

Source from the content-addressed store, hash-verified

148
149
150def docker(
151 name: str,
152 image: str,
153 scripts: list[str],
154 env: dict[str, str],
155 interactive: bool,
156 additional_flags: dict[str, str] | None = None,
157):
158 """
159 Invoke a set of bash scripts through docker/bash.sh
160
161 name: container name
162 image: docker image name
163 scripts: list of bash commands to run
164 env: environment to set
165 """
166 check_docker()
167
168 # As sccache is added to these images these can be uncommented
169 sccache_images = {
170 # "ci_lint",
171 "ci_gpu",
172 "ci_cpu",
173 # "ci_wasm",
174 "ci_cortexm",
175 "ci_arm",
176 "ci_riscv",
177 "ci_adreno",
178 }
179
180 if image in sccache_images and os.getenv("USE_SCCACHE", "1") == "1":
181 scripts = [
182 "sccache --start-server",
183 ] + scripts
184 # Set the C/C++ compiler so CMake picks them up in the build
185 env["CC"] = "/opt/sccache/cc"
186 env["CXX"] = "/opt/sccache/c++"
187 env["SCCACHE_CACHE_SIZE"] = os.getenv("SCCACHE_CACHE_SIZE", "50G")
188 env["SCCACHE_SERVER_PORT"] = os.getenv("SCCACHE_SERVER_PORT", "4226")
189
190 env["PLATFORM"] = name
191
192 docker_bash = REPO_ROOT / "docker" / "bash.sh"
193
194 command = [docker_bash]
195 if sys.stdout.isatty():
196 command.append("-t")
197
198 command.append("--name")
199 command.append(name)
200 if interactive:
201 command.append("-i")
202 scripts = ["interact() {", " bash", "}", "trap interact 0", ""] + scripts
203
204 for key, value in env.items():
205 command.append("--env")
206 command.append(f"{key}={value}")
207

Callers 3

docsFunction · 0.85
lintFunction · 0.85
fnFunction · 0.85

Calls 8

check_dockerFunction · 0.85
strFunction · 0.85
cmdFunction · 0.85
clean_exitFunction · 0.85
writeMethod · 0.65
appendMethod · 0.45
itemsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…