Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[webui] could view trial log | stderr on webui(only support local mode) #2731

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion src/webui/src/components/public-child/OpenRow.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import * as React from 'react';
// import axios from 'axios';
import * as copy from 'copy-to-clipboard';
import { Stack, PrimaryButton, Pivot, PivotItem } from 'office-ui-fabric-react';
import { Trial } from '../../static/model/trial';
import { MANAGER_IP } from '../../static/const';
// import { downFile } from '../../static/function';
import { EXPERIMENT, TRIALS } from '../../static/datamodel';
import JSONTree from 'react-json-tree';
import PaiTrialLog from '../public-child/PaiTrialLog';
import TrialLog from '../public-child/TrialLog';
import MessageInfo from '../Modals/MessageInfo';
import '../../static/style/overview.scss';
import '../../static/style/copyParameter.scss';
import '../../static/style/openRow.scss';

interface OpenRowProps {
trialId: string;
Expand Down Expand Up @@ -55,9 +59,33 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
}
}

// downloadTrialLog = (): void => {
// const { trialId } = this.props;
// // download this trial's log
// const trialLogPromise = axios.get(`${MANAGER_IP}/trial-log/${trialId}/TRIAL_LOG`);
// const stderrPromise = axios.get(`${MANAGER_IP}/trial-log/${trialId}/TRIAL_STDERR`);
// trialLogPromise.then(res => {
// if (res.status === 200) {
// // start to download
// downFile(res.data, `${trialId}.log`);
// }
// });
// stderrPromise.then(res => {
// if (res.status === 200) {
// // start to download
// downFile(res.data, `${trialId}.stderr`);
// }
// });
// }

openTrialLog = (type: string): void => {
window.open(`${MANAGER_IP}/trial-log/${this.props.trialId}/${type}`);
}

render(): React.ReactNode {
const { isHidenInfo, typeInfo, info } = this.state;
const trialId = this.props.trialId;
console.info(trialId); // eslint-disable-line
const trial = TRIALS.getTrial(trialId);
const logPathRow = trial.info.logPath || 'This trial\'s log path is not available.';
return (
Expand Down Expand Up @@ -105,7 +133,23 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
logCollection={EXPERIMENT.logCollectionEnabled}
/>
:
<TrialLog logStr={logPathRow} id={trialId} />
<div>
<TrialLog logStr={logPathRow} id={trialId} />
{/* view each trial log in drawer*/}
<div id="trialog">
<div className="copy" style={{ marginTop: 15 }}>
<PrimaryButton
onClick={this.openTrialLog.bind(this, 'TRIAL_LOG')}
text="View trial log"
/>
<PrimaryButton
onClick={this.openTrialLog.bind(this, 'TRIAL_STDERR')}
text="View stderr log"
styles={{ root: { marginLeft: 15 } }}
/>
</div>
</div>
</div>
}
</PivotItem>
</Pivot>
Expand Down
6 changes: 4 additions & 2 deletions src/webui/src/static/model/trialmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ class TrialManager {
const hpObject = JSON.parse(hyperParameters);
const parameterId = hpObject["parameter_id"];
trial = {
id: `${jobInfo.id}-${parameterId}`,
// id: `${jobInfo.id}-${parameterId}`,
id: jobInfo.id,
jobId: jobInfo.id,
parameterId: parameterId,
sequenceId: parameterId,
// sequenceId: parameterId,
sequenceId: jobInfo.sequenceId,
status: "SUCCEEDED",
startTime: jobInfo.startTime,
endTime: jobInfo.startTime,
Expand Down