Skip to content

Commit 1343a9d

Browse files
committed
feat(debug): stop execution when enter debug mode
1 parent ccc7af1 commit 1343a9d

File tree

13 files changed

+386
-143
lines changed

13 files changed

+386
-143
lines changed

src/api/docker.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { CommandType } from './config';
88
import { yellow, green, red } from 'chalk';
99
import { ProcessOutput } from './process';
1010
import { Readable } from 'stream';
11+
import { processes } from './process-manager';
1112

1213
export const docker = new dockerode();
1314

@@ -240,12 +241,20 @@ export function getContainersStats(): Observable<any> {
240241
let data = JSON.parse(rawJson);
241242

242243
if (data && data.precpu_stats.system_cpu_usage) {
244+
const jobId = container.Names[0].split('_')[2] || -1;
245+
const job = processes.find(p => p.job_id === Number(jobId));
246+
let debug = false;
247+
if (job) {
248+
debug = job.debug || false;
249+
}
250+
243251
const stats = {
244252
id: container.Id,
245253
name: container.Names[0].substr(1) || '',
246254
cpu: getCpuData(data),
247255
network: getNetworkData(data),
248-
memory: getMemory(data)
256+
memory: getMemory(data),
257+
debug: debug
249258
};
250259

251260
stream.destroy();

0 commit comments

Comments
 (0)