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.7 kB

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