Skip to content

Commit 99c65c4

Browse files
committed
Merge remote-tracking branch 'origin/master' into llm-tweak-abuse
2 parents 3064468 + cdea4ab commit 99c65c4

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/packages/frontend/compute/cloud/hyperstack/image.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ export default function Image(props) {
1414
<div style={{ color: "#666", marginBottom: "5px" }}>
1515
Select compute server image. You will be able to use sudo with no
1616
password and can install anything into the Ubuntu 22.04 Linux image.
17-
Click "advanced" for more options, which may be less tested or take
18-
MUCH longer to start due to size.
17+
Clicking "advanced" may show additional less tested or older options.
1918
</div>
2019
)}
21-
<SelectImage {...props} gpu={true} arch={"x86_64"} maxDockerSizeGb={2} />
20+
<SelectImage {...props} gpu={true} arch={"x86_64"} warnBigGb={4} />
2221
<div style={{ color: "#666", marginTop: "5px" }}>
2322
<ImageDescription configuration={props.configuration} />
2423
<ImageLinks

src/packages/frontend/compute/select-image.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ interface Props {
3333
// if specified, only show images with dockerSizeGb set and <= maxDockerSizeGb
3434
// Ignored if advanced is selected
3535
maxDockerSizeGb?: number;
36+
// show a warning if dockerSizeGb is bigger than this:
37+
warnBigGb?: number;
3638
}
3739

3840
export default function SelectImage({
@@ -45,9 +47,13 @@ export default function SelectImage({
4547
googleImages,
4648
arch,
4749
maxDockerSizeGb,
50+
warnBigGb,
4851
}: Props) {
4952
const [advanced, setAdvanced] = useState<boolean>(false);
5053
const [IMAGES, ImagesError] = useImages();
54+
const [dockerSizeGb, setDockerSizeGb] = useState<number | undefined>(
55+
undefined,
56+
);
5157
const [value, setValue] = useState<string | undefined>(configuration.image);
5258
useEffect(() => {
5359
setValue(configuration.image);
@@ -103,6 +109,7 @@ export default function SelectImage({
103109
for (const option of options) {
104110
if (option.value == val) {
105111
x.tag = option.tag;
112+
setDockerSizeGb(option.dockerSizeGb);
106113
break;
107114
}
108115
}
@@ -121,6 +128,21 @@ export default function SelectImage({
121128
configuration={configuration}
122129
/>
123130
)}
131+
{warnBigGb && (dockerSizeGb ?? 0) > warnBigGb && (
132+
<Alert
133+
style={{ margin: "15px 0" }}
134+
showIcon
135+
type="warning"
136+
message="Large Image"
137+
description={
138+
<>
139+
The compute server will take <b>several extra minutes</b> to start
140+
the first time, because the {dockerSizeGb}GB Docker image must be
141+
pulled and decompressed. Please be patient!
142+
</>
143+
}
144+
/>
145+
)}
124146
</div>
125147
);
126148
}
@@ -151,6 +173,7 @@ function getOptions({
151173
value: string;
152174
search: string;
153175
label: JSX.Element;
176+
dockerSizeGb?: number;
154177
}[] = [];
155178
for (const name in IMAGES) {
156179
const image = IMAGES[name];
@@ -217,7 +240,7 @@ function getOptions({
217240
}
218241
}
219242
}
220-
if (advanced && dockerSizeGb) {
243+
if (dockerSizeGb) {
221244
extra += ` - ${dockerSizeGb} GB`;
222245
}
223246

@@ -227,6 +250,7 @@ function getOptions({
227250
priority,
228251
search: label?.toLowerCase() ?? "",
229252
tag,
253+
dockerSizeGb,
230254
label: (
231255
<div style={{ fontSize: "12pt" }}>
232256
<div style={{ float: "right" }}>{versionLabel}</div>

src/packages/frontend/frame-editors/code-editor/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ export class Actions<
258258
// Init setting of value whenever syncstring changes -- only used in derived classes
259259
protected _init_syncstring_value(): void {
260260
this._syncstring.on("change", () => {
261-
if (!this._syncstring) {
262-
// edge case where actions closed but this event was still triggered.
261+
if (!this._syncstring || this._syncstring.versions().length == 0) {
262+
// edge case where actions closed but this event was still triggered, OR
263+
// the syncstring changed, but has not actually loaded a version from
264+
// disk yet, which happens with compute servers for a second.
263265
return;
264266
}
265267
this.setState({ value: this._syncstring.to_str() });

0 commit comments

Comments
 (0)