Commit 6fe23cb6 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20221010-partition' into feat-20221012-environment

parents ae2068b5 28b78e92
...@@ -28,6 +28,8 @@ type IQueueSelectProps = { ...@@ -28,6 +28,8 @@ type IQueueSelectProps = {
error?: boolean; error?: boolean;
helperText?: string; helperText?: string;
disabled?: boolean; disabled?: boolean;
cpuLoading?: boolean;
gpuLoading?: boolean;
}; };
type IMemoryLi = { type IMemoryLi = {
...@@ -65,7 +67,10 @@ const QueueSelect = (props: IQueueSelectProps) => { ...@@ -65,7 +67,10 @@ const QueueSelect = (props: IQueueSelectProps) => {
error, error,
helperText, helperText,
disabled, disabled,
cpuLoading = false,
gpuLoading = false,
} = props; } = props;
// 队列列表由外面传入的设计是考虑到一个表单可能有多次队列选择, 请求队列接口在表单页面完成可以减少请求
const Message = useMessage(); const Message = useMessage();
const [activePartition, setActivePartition] = useState(""); const [activePartition, setActivePartition] = useState("");
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
...@@ -341,6 +346,7 @@ const QueueSelect = (props: IQueueSelectProps) => { ...@@ -341,6 +346,7 @@ const QueueSelect = (props: IQueueSelectProps) => {
handleRow={(e: any) => handleRow(e)} handleRow={(e: any) => handleRow(e)}
activeId={activePartition} activeId={activePartition}
tableKey="partition" tableKey="partition"
loading={cpuLoading}
></MyTable> ></MyTable>
)} )}
{queueType === "GPU" && ( {queueType === "GPU" && (
...@@ -357,6 +363,7 @@ const QueueSelect = (props: IQueueSelectProps) => { ...@@ -357,6 +363,7 @@ const QueueSelect = (props: IQueueSelectProps) => {
handleRow={(e: any) => handleRow(e)} handleRow={(e: any) => handleRow(e)}
activeId={activePartition} activeId={activePartition}
tableKey="partition" tableKey="partition"
loading={gpuLoading}
></MyTable> ></MyTable>
)} )}
</div> </div>
......
...@@ -43,27 +43,36 @@ const ConfigForm = (props: ConfigFormProps) => { ...@@ -43,27 +43,36 @@ const ConfigForm = (props: ConfigFormProps) => {
const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]); const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]);
const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]); const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]);
const { run: getHardwreListFn } = useMyRequest(getHardwreList, { const { run: getCpuList, loading: cpuLoading } = useMyRequest(
onSuccess: (res, params) => { getHardwreList,
if (params[0].computeType === "CPU") { {
onSuccess: (res) => {
setCpuList(res.data); setCpuList(res.data);
} else { },
}
);
const { run: getGpuList, loading: gpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setGpuList(res.data); setGpuList(res.data);
} },
}, }
}); );
useEffect(() => { useEffect(() => {
getHardwreListFn({ zoneId &&
zoneId, getCpuList({
computeType: "CPU", zoneId,
}); computeType: "CPU",
}, [getHardwreListFn, zoneId]); });
}, [getCpuList, zoneId]);
useEffect(() => { useEffect(() => {
getHardwreListFn({ zoneId &&
zoneId, getGpuList({
computeType: "GPU", zoneId,
}); computeType: "GPU",
}, [getHardwreListFn, zoneId]); });
}, [getGpuList, zoneId]);
const [nameHelp, setNameHelp] = useState({ const [nameHelp, setNameHelp] = useState({
error: false, error: false,
...@@ -332,6 +341,8 @@ const ConfigForm = (props: ConfigFormProps) => { ...@@ -332,6 +341,8 @@ const ConfigForm = (props: ConfigFormProps) => {
originalGpuList={gpuList} originalGpuList={gpuList}
error={parameter.error || false} error={parameter.error || false}
helperText={parameter.helperText} helperText={parameter.helperText}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
></QueueSelect> ></QueueSelect>
)} )}
{(parameter.domType || "").toLowerCase() === "input" && ( {(parameter.domType || "").toLowerCase() === "input" && (
......
...@@ -32,6 +32,8 @@ type IParameterSettingProps = { ...@@ -32,6 +32,8 @@ type IParameterSettingProps = {
setTemplateConfigInfo: any; setTemplateConfigInfo: any;
cpuList: Array<IQueueLi>; cpuList: Array<IQueueLi>;
gpuList: Array<IQueueLi>; gpuList: Array<IQueueLi>;
cpuLoading?: boolean;
gpuLoading?: boolean;
}; };
const ParameterSetting = (props: IParameterSettingProps) => { const ParameterSetting = (props: IParameterSettingProps) => {
const { const {
...@@ -40,6 +42,8 @@ const ParameterSetting = (props: IParameterSettingProps) => { ...@@ -40,6 +42,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
taskId, taskId,
cpuList, cpuList,
gpuList, gpuList,
cpuLoading = false,
gpuLoading = false,
} = props; // 算子大数组 } = props; // 算子大数组
const [isShowAllDese, setIsShowAllDese] = useState(false); // 是否展示全部描述 const [isShowAllDese, setIsShowAllDese] = useState(false); // 是否展示全部描述
const [fileSelectOpen, setFileSelectOpen] = useState(false); // 选择输出路径的弹窗显示控制 const [fileSelectOpen, setFileSelectOpen] = useState(false); // 选择输出路径的弹窗显示控制
...@@ -294,6 +298,8 @@ const ParameterSetting = (props: IParameterSettingProps) => { ...@@ -294,6 +298,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
error={parameter.error || false} error={parameter.error || false}
helperText={parameter.helperText} helperText={parameter.helperText}
disabled={parameter.parameterGroup === "out"} disabled={parameter.parameterGroup === "out"}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
></QueueSelect> ></QueueSelect>
)} )}
{(parameter.domType || "").toLowerCase() === "input" && ( {(parameter.domType || "").toLowerCase() === "input" && (
......
...@@ -70,29 +70,36 @@ const WorkFlowEdit = observer((props: IProps) => { ...@@ -70,29 +70,36 @@ const WorkFlowEdit = observer((props: IProps) => {
const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]); const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]);
const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]); const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]);
const { run: getHardwreListFn } = useMyRequest(getHardwreList, { const { run: getCpuList, loading: cpuLoading } = useMyRequest(
onSuccess: (res, params) => { getHardwreList,
if (params[0].computeType === "CPU") { {
onSuccess: (res) => {
setCpuList(res.data); setCpuList(res.data);
} else { },
}
);
const { run: getGpuList, loading: gpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setGpuList(res.data); setGpuList(res.data);
} },
}, }
}); );
useEffect(() => { useEffect(() => {
zoneId && zoneId &&
getHardwreListFn({ getCpuList({
zoneId, zoneId,
computeType: "CPU", computeType: "CPU",
}); });
}, [getHardwreListFn, zoneId]); }, [getCpuList, zoneId]);
useEffect(() => { useEffect(() => {
zoneId && zoneId &&
getHardwreListFn({ getGpuList({
zoneId, zoneId,
computeType: "GPU", computeType: "GPU",
}); });
}, [getHardwreListFn, zoneId]); }, [getGpuList, zoneId]);
// 是否要监听删除时间 // 是否要监听删除时间
const listenState = useMemo(() => { const listenState = useMemo(() => {
...@@ -276,6 +283,8 @@ const WorkFlowEdit = observer((props: IProps) => { ...@@ -276,6 +283,8 @@ const WorkFlowEdit = observer((props: IProps) => {
taskId={selectTaskId || ""} taskId={selectTaskId || ""}
cpuList={cpuList} cpuList={cpuList}
gpuList={gpuList} gpuList={gpuList}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
/> />
)} )}
<div <div
......
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