Skip to content

Commit 1f9686f

Browse files
committed
update coretime service:
1 parent 0b70da1 commit 1f9686f

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

src/services/coretime/CoretimeService.ts

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export class CoretimeService extends AbstractService {
390390
coreId ? this.getAndDecodeWorkplan(historicApi, parseInt(coreId, 10)) : [],
391391
this.getAndDecodeLeases(historicApi, coreId ? parseInt(coreId, 10) : undefined),
392392
this.getAndDecodeReservations(historicApi, coreId ? parseInt(coreId, 10) : undefined),
393-
coreId ? this.getAndDecodeRegions(historicApi, parseInt(coreId, 10)) : [],
393+
this.getAndDecodeRegions(historicApi, coreId ? parseInt(coreId, 10) : undefined),
394394
]);
395395

396396
const cores = workload.reduce(
@@ -409,6 +409,20 @@ export class CoretimeService extends AbstractService {
409409
>,
410410
wl,
411411
) => {
412+
const tasks = wl.info.map((info) => info.task);
413+
414+
let type = 'unknown';
415+
let details: unknown[] = [];
416+
if (leases.find((f) => tasks.includes(f.task))) {
417+
type = 'lease';
418+
details = leases.filter((f) => tasks.includes(f.task));
419+
}
420+
if (reservations.find((f) => tasks.includes(f.task))) {
421+
type = 'reservation';
422+
details = reservations.filter((f) => tasks.includes(f.task));
423+
}
424+
const coreRegions = regions.filter((region) => region.core === wl.core);
425+
console.log(wl.core, type, details, coreRegions);
412426
// workload
413427
// workplan,
414428
// type
@@ -428,24 +442,25 @@ export class CoretimeService extends AbstractService {
428442
leases
429443
reservations
430444
*/
431-
if (acc[wl.core]) {
432-
acc[wl.core] = [
433-
...acc[wl.core],
434-
{
435-
workload: wl,
436-
workplan: workplan.filter((wp) => wp.core === wl.core),
437-
regions: regions.filter((region) => region.core === wl.core),
438-
},
439-
];
440-
} else {
441-
acc[wl.core] = [
442-
{
443-
workload: wl,
444-
workplan: workplan.filter((wp) => wp.core === wl.core) || [],
445-
regions: regions.filter((region) => region.core === wl.core) || [],
446-
},
447-
];
448-
}
445+
// if (acc[wl.core]) {
446+
// acc[wl.core] = [
447+
// ...acc[wl.core],
448+
// {
449+
// workload: wl,
450+
// workplan: workplan.filter((wp) => wp.core === wl.core),
451+
// regions: regions.filter((region) => region.core === wl.core),
452+
// },
453+
// ];
454+
// } else {
455+
// acc[wl.core] = [
456+
// {
457+
// workload: wl,
458+
// workplan: workplan.filter((wp) => wp.core === wl.core) || [],
459+
// regions: regions.filter((region) => region.core === wl.core) || [],
460+
// },
461+
// ];
462+
// }
463+
// return acc;
449464
return acc;
450465
},
451466
{},

0 commit comments

Comments
 (0)