eugenegujing commented on code in PR #8935:
URL: https://github.com/apache/texera/pull/8935#discussion_r4375725598
##########
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:
##########
@@ -431,6 +430,30 @@ export class ComputingUnitSelectionComponent implements
OnInit {
});
}
+ /**
+ * Selects `preferred` once the unit list has loaded and still holds it,
else the first running
+ * unit, else nothing.
+ */
+ private selectFromLoadedUnits(wid: number, preferred?: number): void {
+ this.computingUnitStatusService
+ .getAllComputingUnits()
+ .pipe(
+ filter(units => units.length > 0),
+ take(1),
+ untilDestroyed(this)
+ )
+ .subscribe(units => {
+ // Skip if the workflow changed while the list was loading.
+ if (wid !== this.workflowId) {
+ return;
+ }
+ const unit = units.find(u => u.computingUnit.cuid === preferred) ??
units.find(u => u.status === "Running");
Review Comment:
Good catch! You are correct. Fixed in
6f0d28d4c070caa8084d66b77ccd205eea261d6a.
##########
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:
##########
@@ -431,6 +430,30 @@ export class ComputingUnitSelectionComponent implements
OnInit {
});
}
+ /**
+ * Selects `preferred` once the unit list has loaded and still holds it,
else the first running
+ * unit, else nothing.
+ */
+ private selectFromLoadedUnits(wid: number, preferred?: number): void {
+ this.computingUnitStatusService
+ .getAllComputingUnits()
+ .pipe(
+ filter(units => units.length > 0),
+ take(1),
+ untilDestroyed(this)
+ )
+ .subscribe(units => {
+ // Skip if the workflow changed while the list was loading.
+ if (wid !== this.workflowId) {
+ return;
+ }
Review Comment:
Yes. Added in 6f0d28d4c070caa8084d66b77ccd205eea261d6a.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]