Skip to content

Commit

Permalink
feat(debug): stop execution when enter debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Izak88 committed Oct 30, 2017
1 parent ccc7af1 commit 1343a9d
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 143 deletions.
11 changes: 10 additions & 1 deletion src/api/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CommandType } from './config';
import { yellow, green, red } from 'chalk';
import { ProcessOutput } from './process';
import { Readable } from 'stream';
import { processes } from './process-manager';

export const docker = new dockerode();

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

if (data && data.precpu_stats.system_cpu_usage) {
const jobId = container.Names[0].split('_')[2] || -1;
const job = processes.find(p => p.job_id === Number(jobId));
let debug = false;
if (job) {
debug = job.debug || false;
}

const stats = {
id: container.Id,
name: container.Names[0].substr(1) || '',
cpu: getCpuData(data),
network: getNetworkData(data),
memory: getMemory(data)
memory: getMemory(data),
debug: debug
};

stream.destroy();
Expand Down
Loading

0 comments on commit 1343a9d

Please sign in to comment.