|
- import { ExperimentStatus } from '@/enums';
- import { ActiveLearnInstanceData } from '@/pages/ActiveLearn/types';
- import EmptyLog from '@/pages/AutoML/components/ExperimentLog/empty';
- import LogList from '@/pages/Experiment/components/LogList';
- import { NodeStatus } from '@/types';
- import { Tabs } from 'antd';
- import styles from './index.less';
-
- const NodePrefix = 'active-learn';
-
- type ExperimentLogProps = {
- instanceInfo: ActiveLearnInstanceData;
- nodes: Record<string, NodeStatus>;
- };
-
- function ExperimentLog({ instanceInfo, nodes }: ExperimentLogProps) {
- let hpoNodeStatus: NodeStatus | undefined;
- let frameworkCloneNodeStatus: NodeStatus | undefined;
- let trainCloneNodeStatus: NodeStatus | undefined;
-
- Object.keys(nodes)
- .sort((key1, key2) => {
- const node1 = nodes[key1];
- const node2 = nodes[key2];
- return new Date(node1.startedAt).getTime() - new Date(node2.startedAt).getTime();
- })
- .forEach((key) => {
- const node = nodes[key];
- if (node.displayName.startsWith(NodePrefix)) {
- hpoNodeStatus = node;
- } else if (node.displayName.startsWith('git-clone') && !frameworkCloneNodeStatus) {
- frameworkCloneNodeStatus = node;
- } else if (
- node.displayName.startsWith('git-clone') &&
- frameworkCloneNodeStatus &&
- node.displayName !== frameworkCloneNodeStatus?.displayName
- ) {
- trainCloneNodeStatus = node;
- }
- });
-
- const tabItems = [
- // {
- // key: 'git-clone-framework',
- // label: '框架代码日志',
- // // icon: <KFIcon type="icon-rizhi1" />,
- // children: (
- // <div className={styles['experiment-log__tabs__log']}>
- // {frameworkCloneNodeStatus && (
- // <LogList
- // instanceName={instanceInfo.argo_ins_name}
- // instanceNamespace={instanceInfo.argo_ins_ns}
- // pipelineNodeId={frameworkCloneNodeStatus.displayName}
- // workflowId={frameworkCloneNodeStatus.id}
- // instanceNodeStartTime={frameworkCloneNodeStatus.startedAt}
- // instanceNodeStatus={frameworkCloneNodeStatus.phase as ExperimentStatus}
- // ></LogList>
- // )}
- // </div>
- // ),
- // },
- {
- key: 'git-clone-train',
- label: '系统日志',
- // icon: <KFIcon type="icon-rizhi1" />,
- children: (
- <div className={styles['experiment-log__tabs__log']}>
- {trainCloneNodeStatus ? (
- <LogList
- instanceName={instanceInfo.argo_ins_name}
- instanceNamespace={instanceInfo.argo_ins_ns}
- pipelineNodeId={trainCloneNodeStatus.displayName}
- workflowId={trainCloneNodeStatus.id}
- instanceNodeStartTime={trainCloneNodeStatus.startedAt}
- instanceNodeStatus={trainCloneNodeStatus.phase as ExperimentStatus}
- ></LogList>
- ) : (
- <EmptyLog />
- )}
- </div>
- ),
- },
- {
- key: 'active-learn',
- label: '主动学习日志',
- // icon: <KFIcon type="icon-rizhi1" />,
- children: (
- <div className={styles['experiment-log__tabs__log']}>
- {hpoNodeStatus ? (
- <LogList
- instanceName={instanceInfo.argo_ins_name}
- instanceNamespace={instanceInfo.argo_ins_ns}
- pipelineNodeId={hpoNodeStatus.displayName}
- workflowId={hpoNodeStatus.id}
- instanceNodeStartTime={hpoNodeStatus.startedAt}
- instanceNodeStatus={hpoNodeStatus.phase as ExperimentStatus}
- ></LogList>
- ) : (
- <EmptyLog />
- )}
- </div>
- ),
- },
- ];
-
- return (
- <div className={styles['experiment-log']}>
- <Tabs className={styles['experiment-log__tabs']} items={tabItems} />
- </div>
- );
- }
-
- export default ExperimentLog;
|