[arvados] updated: 2.7.0-5602-g9d79c79678

git repository hosting git at public.arvados.org
Tue Dec 19 16:07:04 UTC 2023


Summary of changes:
 services/workbench2/src/common/formatters.test.ts  | 52 +++++++++++++++++++++-
 services/workbench2/src/common/formatters.ts       | 15 +++++--
 services/workbench2/src/components/icon/icon.tsx   |  3 +-
 .../src/store/breadcrumbs/breadcrumbs-actions.ts   |  4 +-
 .../side-panel-tree/side-panel-tree-actions.ts     |  4 +-
 .../src/store/workbench/workbench-actions.ts       |  1 +
 .../views-components/main-app-bar/account-menu.tsx |  2 -
 .../side-panel-tree/side-panel-tree.tsx            |  4 +-
 .../instance-types-panel/instance-types-panel.tsx  | 25 ++++++++---
 .../views/process-panel/process-resource-card.tsx  |  4 +-
 10 files changed, 93 insertions(+), 21 deletions(-)

       via  9d79c796788c259b759adb16d5c87f18c52380b3 (commit)
       via  f8207f94af84bfab4f506a8fa4229f8bcb926ae8 (commit)
       via  ea87e9c1154efb3ac7ea35f2c9e92b0262f3ba20 (commit)
       via  aa29646b94556f244a2a8ef5f422d9e91b95ffe0 (commit)
       via  0c9db5b63420bab25e970c75dfd9169b9c7db139 (commit)
      from  ee9d1e39b5d469a827be5a719c9c0860914ab2a8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9d79c796788c259b759adb16d5c87f18c52380b3
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Dec 19 11:06:46 2023 -0500

    19675: Reorder instance type fields
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
index 0aa287e24e..3a6247b624 100644
--- a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
+++ b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
@@ -71,13 +71,13 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)(
                                             Cores: {instanceType.VCPUs}
                                         </Typography>
                                         <Typography>
-                                            Preemptible: {instanceType.Preemptible.toString()}
+                                            Max RAM request: {formatCWLResourceSize(ramRequest)} ({formatFileSize(ramRequest)})
                                         </Typography>
                                         <Typography>
                                             Max disk request: {formatCWLResourceSize(diskRequest)} ({formatFileSize(diskRequest)})
                                         </Typography>
                                         <Typography>
-                                            Max RAM request: {formatCWLResourceSize(ramRequest)} ({formatFileSize(ramRequest)})
+                                            Preemptible: {instanceType.Preemptible.toString()}
                                         </Typography>
                                         {instanceType.CUDA && instanceType.CUDA.DeviceCount > 0 ?
                                             <>

commit f8207f94af84bfab4f506a8fa4229f8bcb926ae8
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Dec 19 10:54:45 2023 -0500

    19675: Sort instance types panel by price then by ProviderType
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
index cb901639d6..0aa287e24e 100644
--- a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
+++ b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
@@ -41,7 +41,16 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)(
             <CardContent>
                 <Grid container direction="row">
                     {Object.keys(instances).length > 0 ?
-                        Object.keys(instances).map((instanceKey) => {
+                        Object.keys(instances).sort((a, b) => {
+                            const typeA = instances[a];
+                            const typeB = instances[b];
+
+                            if (typeA.Price !== typeB.Price) {
+                                return typeA.Price - typeB.Price;
+                            } else {
+                                return typeA.ProviderType.localeCompare(typeB.ProviderType);
+                            }
+                        }).map((instanceKey) => {
                             const instanceType = instances[instanceKey];
                             const diskRequest = instanceType.IncludedScratch;
                             const ramRequest = instanceType.RAM - config.Containers.ReserveExtraRAM;

commit ea87e9c1154efb3ac7ea35f2c9e92b0262f3ba20
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Dec 19 10:54:03 2023 -0500

    19675: Move instance types panel to left panel
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
index 44dfe86938..3fad5f587a 100644
--- a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
+++ b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts
@@ -24,6 +24,7 @@ export enum SidePanelTreeCategory {
     PUBLIC_FAVORITES = 'Public Favorites',
     SHARED_WITH_ME = 'Shared with me',
     ALL_PROCESSES = 'All Processes',
+    INSTANCE_TYPES = 'Instance Types',
     SHELL_ACCESS = 'Shell Access',
     GROUPS = 'Groups',
     TRASH = 'Trash',
@@ -53,6 +54,7 @@ let SIDE_PANEL_CATEGORIES: string[] = [
     SidePanelTreeCategory.PUBLIC_FAVORITES,
     SidePanelTreeCategory.SHARED_WITH_ME,
     SidePanelTreeCategory.ALL_PROCESSES,
+    SidePanelTreeCategory.INSTANCE_TYPES,
     SidePanelTreeCategory.SHELL_ACCESS,
     SidePanelTreeCategory.GROUPS,
     SidePanelTreeCategory.TRASH
@@ -120,7 +122,7 @@ const loadProject = (projectUuid: string) =>
         };
 
         const { items } = await services.projectService.list(params);
-        
+
         dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
             id: projectUuid,
             pickerId: SIDE_PANEL_TREE,
diff --git a/services/workbench2/src/store/workbench/workbench-actions.ts b/services/workbench2/src/store/workbench/workbench-actions.ts
index b12f52b58f..c6e7ff66d3 100644
--- a/services/workbench2/src/store/workbench/workbench-actions.ts
+++ b/services/workbench2/src/store/workbench/workbench-actions.ts
@@ -762,6 +762,7 @@ export const loadSshKeys = handleFirstTimeLoad(async (dispatch: Dispatch<any>) =
 });
 
 export const loadInstanceTypes = handleFirstTimeLoad(async (dispatch: Dispatch<any>) => {
+    dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.INSTANCE_TYPES));
     dispatch(setInstanceTypesBreadcrumbs());
 });
 
diff --git a/services/workbench2/src/views-components/main-app-bar/account-menu.tsx b/services/workbench2/src/views-components/main-app-bar/account-menu.tsx
index b1a71ef25e..02dd54f1c4 100644
--- a/services/workbench2/src/views-components/main-app-bar/account-menu.tsx
+++ b/services/workbench2/src/views-components/main-app-bar/account-menu.tsx
@@ -18,7 +18,6 @@ import {
     navigateToSshKeysUser,
     navigateToMyAccount,
     navigateToLinkAccount,
-    navigateToInstanceTypes
 } from 'store/navigation/navigation-action';
 import { openUserVirtualMachines } from "store/virtual-machines/virtual-machines-actions";
 import { pluginConfig } from 'plugins';
@@ -59,7 +58,6 @@ export const AccountMenuComponent =
                 dispatch(openTokenDialog);
             }}>Get API token</MenuItem>
             <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
-            <MenuItem onClick={() => dispatch(navigateToInstanceTypes)}>Instance Types</MenuItem>
             <MenuItem onClick={() => dispatch(navigateToSiteManager)}>Site Manager</MenuItem>
             <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
             <MenuItem onClick={() => dispatch(navigateToLinkAccount)}>Link account</MenuItem>
diff --git a/services/workbench2/src/views-components/side-panel-tree/side-panel-tree.tsx b/services/workbench2/src/views-components/side-panel-tree/side-panel-tree.tsx
index 19ab3184af..f8cd9efe46 100644
--- a/services/workbench2/src/views-components/side-panel-tree/side-panel-tree.tsx
+++ b/services/workbench2/src/views-components/side-panel-tree/side-panel-tree.tsx
@@ -9,7 +9,7 @@ import { TreePicker, TreePickerProps } from "../tree-picker/tree-picker";
 import { TreeItem } from "components/tree/tree";
 import { ProjectResource } from "models/project";
 import { ListItemTextIcon } from "components/list-item-text-icon/list-item-text-icon";
-import { ProcessIcon, ProjectIcon, FilterGroupIcon, FavoriteIcon, ProjectsIcon, ShareMeIcon, TrashIcon, PublicFavoriteIcon, GroupsIcon, TerminalIcon } from 'components/icon/icon';
+import { ProcessIcon, ProjectIcon, FilterGroupIcon, FavoriteIcon, ProjectsIcon, ShareMeIcon, TrashIcon, PublicFavoriteIcon, GroupsIcon, TerminalIcon, ResourceIcon } from 'components/icon/icon';
 import { activateSidePanelTreeItem, toggleSidePanelTreeItemCollapse, SIDE_PANEL_TREE, SidePanelTreeCategory } from 'store/side-panel-tree/side-panel-tree-actions';
 import { openSidePanelContextMenu } from 'store/context-menu/context-menu-actions';
 import { noop } from 'lodash';
@@ -80,6 +80,8 @@ export const getSidePanelIcon = (category: string) => {
             return PublicFavoriteIcon;
         case SidePanelTreeCategory.ALL_PROCESSES:
             return ProcessIcon;
+        case SidePanelTreeCategory.INSTANCE_TYPES:
+            return ResourceIcon;
         case SidePanelTreeCategory.GROUPS:
             return GroupsIcon;
         case SidePanelTreeCategory.SHELL_ACCESS:

commit aa29646b94556f244a2a8ef5f422d9e91b95ffe0
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Dec 19 10:52:43 2023 -0500

    19675: Rename memory icon to reflect resource usage, use icon for instance type
    panel
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/components/icon/icon.tsx b/services/workbench2/src/components/icon/icon.tsx
index 69ebffd7ed..d81f43eb7a 100644
--- a/services/workbench2/src/components/icon/icon.tsx
+++ b/services/workbench2/src/components/icon/icon.tsx
@@ -210,7 +210,7 @@ export const KeyIcon: IconType = props => <VpnKey {...props} />;
 export const LogIcon: IconType = props => <SettingsEthernet {...props} />;
 export const MailIcon: IconType = props => <Mail {...props} />;
 export const MaximizeIcon: IconType = props => <FullscreenSharp {...props} />;
-export const MemoryIcon: IconType = props => <Memory {...props} />;
+export const ResourceIcon: IconType = props => <Memory {...props} />;
 export const UnMaximizeIcon: IconType = props => <FullscreenExitSharp {...props} />;
 export const MoreVerticalIcon: IconType = props => <MoreVert {...props} />;
 export const MoreHorizontalIcon: IconType = props => <MoreHoriz {...props} />;
@@ -268,4 +268,3 @@ export const StartIcon: IconType = props => <PlayArrow {...props} />;
 export const StopIcon: IconType = props => <Stop {...props} />;
 export const SelectAllIcon: IconType = props => <CheckboxMultipleOutline {...props} />;
 export const SelectNoneIcon: IconType = props => <CheckboxMultipleBlankOutline {...props} />;
-export const InstanceTypeIcon: IconType = props => <Storage {...props} />;
diff --git a/services/workbench2/src/store/breadcrumbs/breadcrumbs-actions.ts b/services/workbench2/src/store/breadcrumbs/breadcrumbs-actions.ts
index 80348f3791..018a64ce9b 100644
--- a/services/workbench2/src/store/breadcrumbs/breadcrumbs-actions.ts
+++ b/services/workbench2/src/store/breadcrumbs/breadcrumbs-actions.ts
@@ -20,7 +20,7 @@ import { ProcessResource } from 'models/process';
 import { OrderBuilder } from 'services/api/order-builder';
 import { Breadcrumb } from 'components/breadcrumbs/breadcrumbs';
 import { ContainerRequestResource, containerRequestFieldsNoMounts } from 'models/container-request';
-import { AdminMenuIcon, CollectionIcon, IconType, InstanceTypeIcon, ProcessIcon, ProjectIcon, WorkflowIcon } from 'components/icon/icon';
+import { AdminMenuIcon, CollectionIcon, IconType, ProcessIcon, ProjectIcon, ResourceIcon, WorkflowIcon } from 'components/icon/icon';
 import { CollectionResource } from 'models/collection';
 import { getSidePanelIcon } from 'views-components/side-panel-tree/side-panel-tree';
 import { WorkflowResource } from 'models/workflow';
@@ -296,7 +296,7 @@ export const INSTANCE_TYPES_PANEL_LABEL = 'Instance Types';
 export const setInstanceTypesBreadcrumbs = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(setBreadcrumbs([
-            { label: INSTANCE_TYPES_PANEL_LABEL, uuid: INSTANCE_TYPES_PANEL_LABEL, icon: InstanceTypeIcon },
+            { label: INSTANCE_TYPES_PANEL_LABEL, uuid: INSTANCE_TYPES_PANEL_LABEL, icon: ResourceIcon },
         ]));
     };
 
diff --git a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
index 006a119797..cb901639d6 100644
--- a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
+++ b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
@@ -5,7 +5,7 @@
 import React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Typography, Grid } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
-import { InstanceTypeIcon } from 'components/icon/icon';
+import { ResourceIcon } from 'components/icon/icon';
 import { RootState } from 'store/store';
 import { connect } from 'react-redux';
 import { ClusterConfigJSON } from 'common/config';
@@ -88,7 +88,7 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)(
                             </Grid>
                         }) :
                         <NotFoundView
-                            icon={InstanceTypeIcon}
+                            icon={ResourceIcon}
                             messages={["No instances found"]}
                         />
                     }
diff --git a/services/workbench2/src/views/process-panel/process-resource-card.tsx b/services/workbench2/src/views/process-panel/process-resource-card.tsx
index b39f48ea12..4e849173fb 100644
--- a/services/workbench2/src/views/process-panel/process-resource-card.tsx
+++ b/services/workbench2/src/views/process-panel/process-resource-card.tsx
@@ -19,7 +19,7 @@ import { ArvadosTheme } from 'common/custom-theme';
 import {
     CloseIcon,
     MaximizeIcon,
-    MemoryIcon,
+    ResourceIcon,
     UnMaximizeIcon,
 } from 'components/icon/icon';
 import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view';
@@ -88,7 +88,7 @@ export const ProcessResourceCard = withStyles(styles)(connect()(
                     content: classes.title,
                     avatar: classes.avatar,
                 }}
-                avatar={<MemoryIcon className={classes.iconHeader} />}
+                avatar={<ResourceIcon className={classes.iconHeader} />}
                 title={
                     <Typography noWrap variant='h6' color='inherit'>
                         Resources

commit 0c9db5b63420bab25e970c75dfd9169b9c7db139
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Dec 19 10:49:05 2023 -0500

    19675: Add CWL size formatter and display MiB max ram/disk request alongside
    human readable units
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/common/formatters.test.ts b/services/workbench2/src/common/formatters.test.ts
index 7f9ffa0c35..cde1a4f9d2 100644
--- a/services/workbench2/src/common/formatters.test.ts
+++ b/services/workbench2/src/common/formatters.test.ts
@@ -2,7 +2,57 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { formatUploadSpeed, formatCost } from "./formatters";
+import { formatFileSize, formatUploadSpeed, formatCost, formatCWLResourceSize } from "./formatters";
+
+describe('formatFileSize', () => {
+    it('should pick the largest unit', () => {
+        const base = 1024;
+        const testCases = [
+            {input: 0, output: '0 B'},
+            {input: 1, output: '1 B'},
+            {input: 1023, output: '1023 B'},
+            {input: base, output: '1.0 KiB'},
+            {input: 1.1 * base, output: '1.1 KiB'},
+            {input: 1.5 * base, output: '1.5 KiB'},
+            {input: base ** 2, output: '1.0 MiB'},
+            {input: 1.5 * (base ** 2), output: '1.5 MiB'},
+            {input: base ** 3, output: '1.0 GiB'},
+            {input: base ** 4, output: '1.0 TiB'},
+        ];
+
+        for (const { input, output } of testCases) {
+            expect(formatFileSize(input)).toBe(output);
+        }
+    });
+
+    it('should handle accidental empty string or undefined input', () => {
+        expect(formatFileSize('')).toBe('-');
+        expect(formatFileSize(undefined)).toBe('-');
+    });
+
+    it('should handle accidental non-empty string input', () => {
+        expect(formatFileSize('foo')).toBe('0 B');
+    });
+});
+
+describe('formatCWLResourceSize', () => {
+    it('should format bytes as MiB', () => {
+        const base = 1024 ** 2;
+
+        const testCases = [
+            {input: 0, output: '0 MiB'},
+            {input: 1, output: '0 MiB'},
+            {input: base - 1, output: '1 MiB'},
+            {input: 2 * base, output: '2 MiB'},
+            {input: 1024 * base, output: '1024 MiB'},
+            {input: 10000 * base, output: '10000 MiB'},
+        ];
+
+        for (const { input, output } of testCases) {
+            expect(formatCWLResourceSize(input)).toBe(output);
+        }
+    });
+});
 
 describe('formatUploadSpeed', () => {
     it('should show speed less than 1MB/s', () => {
diff --git a/services/workbench2/src/common/formatters.ts b/services/workbench2/src/common/formatters.ts
index 3366af0d56..e44a21e026 100644
--- a/services/workbench2/src/common/formatters.ts
+++ b/services/workbench2/src/common/formatters.ts
@@ -41,6 +41,10 @@ export const formatFileSize = (size?: number | string) => {
     return '0 B';
 };
 
+export const formatCWLResourceSize = (size: number) => {
+    return `${(size / CWL_SIZE.base).toFixed(0)} ${CWL_SIZE.unit}`;
+};
+
 export const formatTime = (time: number, seconds?: boolean) => {
     const minutes = Math.floor((time / (1000 * 60)) % 60).toFixed(0);
     const hours = Math.floor(time / (1000 * 60 * 60)).toFixed(0);
@@ -78,15 +82,15 @@ export function formatUploadSpeed(
 
 const FILE_SIZES = [
     {
-        base: 1099511627776,
+        base: 1024 ** 4,
         unit: 'TiB',
     },
     {
-        base: 1073741824,
+        base: 1024 ** 3,
         unit: 'GiB',
     },
     {
-        base: 1048576,
+        base: 1024 ** 2,
         unit: 'MiB',
     },
     {
@@ -99,6 +103,11 @@ const FILE_SIZES = [
     },
 ];
 
+const CWL_SIZE = {
+    base: 1024 ** 2,
+    unit: 'MiB',
+};
+
 export const formatPropertyValue = (
     pv: PropertyValue,
     vocabulary?: Vocabulary
diff --git a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
index a18f5d2368..006a119797 100644
--- a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
+++ b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx
@@ -10,7 +10,7 @@ import { RootState } from 'store/store';
 import { connect } from 'react-redux';
 import { ClusterConfigJSON } from 'common/config';
 import { NotFoundView } from 'views/not-found-panel/not-found-panel';
-import { formatCost, formatFileSize } from 'common/formatters';
+import { formatCWLResourceSize, formatCost, formatFileSize } from 'common/formatters';
 
 type CssRules = 'root' | 'instanceType';
 
@@ -43,6 +43,8 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)(
                     {Object.keys(instances).length > 0 ?
                         Object.keys(instances).map((instanceKey) => {
                             const instanceType = instances[instanceKey];
+                            const diskRequest = instanceType.IncludedScratch;
+                            const ramRequest = instanceType.RAM - config.Containers.ReserveExtraRAM;
 
                             return <Grid data-cy={instanceKey} className={classes.instanceType} item sm={6} xs={12} key={instanceKey}>
                                 <Card>
@@ -63,10 +65,10 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)(
                                             Preemptible: {instanceType.Preemptible.toString()}
                                         </Typography>
                                         <Typography>
-                                            Max disk request: {formatFileSize(instanceType.IncludedScratch)}
+                                            Max disk request: {formatCWLResourceSize(diskRequest)} ({formatFileSize(diskRequest)})
                                         </Typography>
                                         <Typography>
-                                            Max ram request: {formatFileSize(instanceType.RAM - config.Containers.ReserveExtraRAM)}
+                                            Max RAM request: {formatCWLResourceSize(ramRequest)} ({formatFileSize(ramRequest)})
                                         </Typography>
                                         {instanceType.CUDA && instanceType.CUDA.DeviceCount > 0 ?
                                             <>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list