You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 3.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { ExperimentStatus } from '@/enums';
  2. import { ActiveLearnInstanceData } from '@/pages/ActiveLearn/types';
  3. import EmptyLog from '@/pages/AutoML/components/ExperimentLog/empty';
  4. import LogList from '@/pages/Experiment/components/LogList';
  5. import { NodeStatus } from '@/types';
  6. import { Tabs } from 'antd';
  7. import styles from './index.less';
  8. const NodePrefix = 'active-learn';
  9. type ExperimentLogProps = {
  10. instanceInfo: ActiveLearnInstanceData;
  11. nodes: Record<string, NodeStatus>;
  12. };
  13. function ExperimentLog({ instanceInfo, nodes }: ExperimentLogProps) {
  14. let hpoNodeStatus: NodeStatus | undefined;
  15. let frameworkCloneNodeStatus: NodeStatus | undefined;
  16. let trainCloneNodeStatus: NodeStatus | undefined;
  17. Object.keys(nodes)
  18. .sort((key1, key2) => {
  19. const node1 = nodes[key1];
  20. const node2 = nodes[key2];
  21. return new Date(node1.startedAt).getTime() - new Date(node2.startedAt).getTime();
  22. })
  23. .forEach((key) => {
  24. const node = nodes[key];
  25. if (node.displayName.startsWith(NodePrefix)) {
  26. hpoNodeStatus = node;
  27. } else if (node.displayName.startsWith('git-clone') && !frameworkCloneNodeStatus) {
  28. frameworkCloneNodeStatus = node;
  29. } else if (
  30. node.displayName.startsWith('git-clone') &&
  31. frameworkCloneNodeStatus &&
  32. node.displayName !== frameworkCloneNodeStatus?.displayName
  33. ) {
  34. trainCloneNodeStatus = node;
  35. }
  36. });
  37. const tabItems = [
  38. // {
  39. // key: 'git-clone-framework',
  40. // label: '框架代码日志',
  41. // // icon: <KFIcon type="icon-rizhi1" />,
  42. // children: (
  43. // <div className={styles['experiment-log__tabs__log']}>
  44. // {frameworkCloneNodeStatus && (
  45. // <LogList
  46. // instanceName={instanceInfo.argo_ins_name}
  47. // instanceNamespace={instanceInfo.argo_ins_ns}
  48. // pipelineNodeId={frameworkCloneNodeStatus.displayName}
  49. // workflowId={frameworkCloneNodeStatus.id}
  50. // instanceNodeStartTime={frameworkCloneNodeStatus.startedAt}
  51. // instanceNodeStatus={frameworkCloneNodeStatus.phase as ExperimentStatus}
  52. // ></LogList>
  53. // )}
  54. // </div>
  55. // ),
  56. // },
  57. {
  58. key: 'git-clone-train',
  59. label: '系统日志',
  60. // icon: <KFIcon type="icon-rizhi1" />,
  61. children: (
  62. <div className={styles['experiment-log__tabs__log']}>
  63. {trainCloneNodeStatus ? (
  64. <LogList
  65. instanceName={instanceInfo.argo_ins_name}
  66. instanceNamespace={instanceInfo.argo_ins_ns}
  67. pipelineNodeId={trainCloneNodeStatus.displayName}
  68. workflowId={trainCloneNodeStatus.id}
  69. instanceNodeStartTime={trainCloneNodeStatus.startedAt}
  70. instanceNodeStatus={trainCloneNodeStatus.phase as ExperimentStatus}
  71. ></LogList>
  72. ) : (
  73. <EmptyLog />
  74. )}
  75. </div>
  76. ),
  77. },
  78. {
  79. key: 'active-learn',
  80. label: '主动学习日志',
  81. // icon: <KFIcon type="icon-rizhi1" />,
  82. children: (
  83. <div className={styles['experiment-log__tabs__log']}>
  84. {hpoNodeStatus ? (
  85. <LogList
  86. instanceName={instanceInfo.argo_ins_name}
  87. instanceNamespace={instanceInfo.argo_ins_ns}
  88. pipelineNodeId={hpoNodeStatus.displayName}
  89. workflowId={hpoNodeStatus.id}
  90. instanceNodeStartTime={hpoNodeStatus.startedAt}
  91. instanceNodeStatus={hpoNodeStatus.phase as ExperimentStatus}
  92. ></LogList>
  93. ) : (
  94. <EmptyLog />
  95. )}
  96. </div>
  97. ),
  98. },
  99. ];
  100. return (
  101. <div className={styles['experiment-log']}>
  102. <Tabs className={styles['experiment-log__tabs']} items={tabItems} />
  103. </div>
  104. );
  105. }
  106. export default ExperimentLog;