Unverified Commit 521f1917 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Fix a logging related bug (#3705)

parent b7c91e73
......@@ -18,7 +18,7 @@ type SCHEDULE_POLICY_NAME = 'random' | 'round-robin';
export class GPUScheduler {
private readonly machineExecutorMap: Map<RemoteMachineConfig, ExecutorManager>;
private readonly log: Logger = getLogger();
private readonly log: Logger = getLogger('GPUScheduler');
private readonly policyName: SCHEDULE_POLICY_NAME = 'round-robin';
private roundRobinIndex: number = 0;
private configuredRMs: RemoteMachineMeta[] = [];
......
......@@ -67,7 +67,7 @@ class RemoteMachineTrainingService implements TrainingService {
this.sshConnectionPromises = [];
this.expRootDir = getExperimentRootDir();
this.timer = component.get(ObservableTimer);
this.log = getLogger();
this.log = getLogger('RemoteMachineTrainingService');
this.log.info('Construct remote machine training service.');
this.config = flattenConfig(config, 'remote');
......
......@@ -36,7 +36,7 @@ class ShellExecutor {
public isWindows: boolean = false;
constructor() {
this.log = getLogger();
this.log = getLogger('ShellExecutor');
this.sshClient = new Client();
}
......
......@@ -61,7 +61,7 @@ export class WebCommandChannel extends CommandChannel {
this.webSocketServer.on('connection', (client: WebSocket) => {
this.log.debug(`WebCommandChannel: received connection`);
client.onerror = (event): void => {
this.log.error(`error on client ${JSON.stringify(event)}`);
this.log.error('error on client', event);
}
this.clients.set(client, undefined);
......@@ -109,7 +109,7 @@ export class WebCommandChannel extends CommandChannel {
// undefined means it's expecting initializing message.
const commands = this.parseCommands(rawCommands);
let isValid = false;
this.log.debug(`WebCommandChannel: received initialize message: ${JSON.stringify(rawCommands)}`);
this.log.debug('WebCommandChannel: received initialize message:', rawCommands);
if (commands.length > 0) {
const commandType = commands[0][0];
......
......@@ -50,7 +50,7 @@ export abstract class CommandChannel {
private readonly commandPattern: RegExp = /(?<type>[\w]{2})(?<length>[\d]{14})(?<data>.*)\n?/gm;
public constructor(commandEmitter: EventEmitter) {
this.log = getLogger();
this.log = getLogger('CommandChannel');
this.commandEmitter = commandEmitter;
}
......
......@@ -82,7 +82,7 @@ export class EnvironmentInformation {
public useSharedStorage?: boolean;
constructor(id: string, name: string, envId?: string) {
this.log = getLogger();
this.log = getLogger('EnvironmentInformation');
this.id = id;
this.name = name;
this.envId = envId ? envId : name;
......@@ -116,7 +116,7 @@ export class EnvironmentInformation {
const gpuSummary = this.gpuSummaries.get(this.defaultNodeId);
if (gpuSummary === undefined) {
if (false === this.isNoGpuWarned) {
this.log.warning(`EnvironmentInformation: ${this.envId} no default gpu found. current gpu info ${JSON.stringify(this.gpuSummaries)}`);
this.log.warning(`EnvironmentInformation: ${this.envId} no default gpu found. current gpu info`, this.gpuSummaries);
this.isNoGpuWarned = true;
}
} else {
......
......@@ -24,7 +24,7 @@ interface FlattenAmlConfig extends ExperimentConfig, AmlConfig { }
@component.Singleton
export class AMLEnvironmentService extends EnvironmentService {
private readonly log: Logger = getLogger();
private readonly log: Logger = getLogger('AMLEnvironmentService');
private experimentId: string;
private experimentRootDir: string;
private config: FlattenAmlConfig;
......
......@@ -17,7 +17,7 @@ import { SharedStorageService } from '../sharedStorage'
@component.Singleton
export class LocalEnvironmentService extends EnvironmentService {
private readonly log: Logger = getLogger();
private readonly log: Logger = getLogger('LocalEnvironmentService');
private experimentRootDir: string;
private experimentId: string;
......
......@@ -23,7 +23,7 @@ interface FlattenOpenpaiConfig extends ExperimentConfig, OpenpaiConfig { }
@component.Singleton
export class OpenPaiEnvironmentService extends EnvironmentService {
private readonly log: Logger = getLogger();
private readonly log: Logger = getLogger('OpenPaiEnvironmentService');
private paiClusterConfig: PAIClusterConfig | undefined;
private paiTrialConfig: NNIPAITrialConfig | undefined;
private paiToken: string;
......@@ -77,7 +77,7 @@ export class OpenPaiEnvironmentService extends EnvironmentService {
// Status code 200 for success
if ((error !== undefined && error !== null) || response.statusCode >= 400) {
const errorMessage: string = (error !== undefined && error !== null) ? error.message :
`OpenPAI: get environment list from PAI Cluster failed!, http code:${response.statusCode}, http body: ${JSON.stringify(body)}`;
`OpenPAI: get environment list from PAI Cluster failed!, http code:${response.statusCode}, http body:' ${JSON.stringify(body)}`;
this.log.error(`${errorMessage}`);
deferred.reject(errorMessage);
} else {
......@@ -113,7 +113,7 @@ export class OpenPaiEnvironmentService extends EnvironmentService {
this.log.debug(`OpenPAI: job ${environment.envId} change status ${oldEnvironmentStatus} to ${environment.status} due to job is ${jobResponse.state}.`)
}
} else {
this.log.error(`OpenPAI: job ${environment.envId} has no state returned. body:${JSON.stringify(jobResponse)}`);
this.log.error(`OpenPAI: job ${environment.envId} has no state returned. body:`, jobResponse);
// some error happens, and mark this environment
environment.status = 'FAILED';
}
......
......@@ -39,7 +39,7 @@ export class RemoteEnvironmentService extends EnvironmentService {
this.machineExecutorManagerMap = new Map<RemoteMachineConfig, ExecutorManager>();
this.remoteMachineMetaOccupiedMap = new Map<RemoteMachineConfig, boolean>();
this.experimentRootDir = experimentRootDir;
this.log = getLogger();
this.log = getLogger('RemoteEnvironmentService');
this.config = flattenConfig(config, 'remote');
// codeDir is not a valid directory, throw Error
......
......@@ -29,7 +29,7 @@ export type GpuScheduleResult = {
export class GpuScheduler {
// private readonly machineExecutorMap: Set<TrialDetail>;
private readonly log: Logger = getLogger();
private readonly log: Logger = getLogger('GpuScheduler');
private readonly policyName: SCHEDULE_POLICY_NAME = 'recently-idle';
private defaultSetting: GpuSchedulerSetting;
private roundRobinIndex: number = 0;
......
......@@ -66,7 +66,7 @@ export class AzureBlobSharedStorageService extends SharedStorageService {
constructor() {
super();
this.log = getLogger();
this.log = getLogger('AzureBlobSharedStorageService');
this.internalStorageService = new MountedStorageService();
this.experimentId = getExperimentId();
}
......
......@@ -50,7 +50,7 @@ export class NFSSharedStorageService extends SharedStorageService {
constructor() {
super();
this.log = getLogger();
this.log = getLogger('NFSSharedStorageService');
this.internalStorageService = new MountedStorageService();
this.experimentId = getExperimentId();
}
......
......@@ -30,7 +30,7 @@ export abstract class StorageService {
protected abstract internalBasename(...paths: string[]): string;
constructor() {
this.logger = getLogger();
this.logger = getLogger('StorageService');
}
public initialize(localRoot: string, remoteRoot: string): void {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment