(opts: TaskOperationsRestoreOptions)
| 165 | } |
| 166 | |
| 167 | async restore(opts: TaskOperationsRestoreOptions) { |
| 168 | await this.#initialize(); |
| 169 | |
| 170 | const containerName = this.#getRunContainerName(opts.runId); |
| 171 | |
| 172 | if (!this.#canCheckpoint || this.opts.forceSimulate) { |
| 173 | logger.log("Simulating restore"); |
| 174 | |
| 175 | const unpause = logger.debug(await $`docker unpause ${containerName}`); |
| 176 | |
| 177 | if (unpause.exitCode !== 0) { |
| 178 | throw new Error("docker unpause command failed"); |
| 179 | } |
| 180 | |
| 181 | await this.#sendPostStart(containerName); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | const { exitCode } = logger.debug( |
| 186 | await $`docker start --checkpoint=${opts.checkpointRef} ${containerName}` |
| 187 | ); |
| 188 | |
| 189 | if (exitCode !== 0) { |
| 190 | throw new Error("docker start command failed"); |
| 191 | } |
| 192 | |
| 193 | await this.#sendPostStart(containerName); |
| 194 | } |
| 195 | |
| 196 | async delete(opts: { runId: string }) { |
| 197 | await this.#initialize(); |
no test coverage detected