Skip to content

Commit 0760a61

Browse files
Merge commit '7db0746426b9b828b2c43b9b5050c6f70cd57ed6' into feature/engine-extension-3
2 parents a8ea020 + 7db0746 commit 0760a61

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

src/resources/extension-subtrees/julia-engine/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You'll need the `feature/engine-extension` branch of Quarto, until it's merged.
1515
To build the TypeScript engine extension:
1616

1717
```bash
18-
quarto dev-call build-ts-extension
18+
quarto call build-ts-extension
1919
```
2020

2121
This bundles `src/julia-engine.ts` into `_extensions/julia-engine/julia-engine.js`.

src/resources/extension-subtrees/julia-engine/src/julia-engine.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
// Standard library imports
88
import { join, resolve } from "path";
9-
import { error, info } from "log";
109
import { existsSync } from "fs/exists";
1110
import { encodeBase64 } from "encoding/base64";
1211

@@ -199,7 +198,7 @@ export const juliaEngineDiscovery: ExecutionEngineDiscovery = {
199198
const nb = await executeJulia(juliaExecOptions);
200199

201200
if (!nb) {
202-
error("Execution of notebook returned undefined");
201+
quarto.console.error("Execution of notebook returned undefined");
203202
return Promise.reject();
204203
}
205204

@@ -334,7 +333,7 @@ async function startOrReuseJuliaServer(
334333
options,
335334
`Transport file ${transportFile} doesn't exist`,
336335
);
337-
info("Starting julia control server process. This might take a while...");
336+
quarto.console.info("Starting julia control server process. This might take a while...");
338337

339338
let juliaProject = Deno.env.get("QUARTO_JULIA_PROJECT");
340339

@@ -561,18 +560,18 @@ async function getJuliaServerConnection(
561560
transportOptions = await pollTransportFile(options);
562561
} catch (err) {
563562
if (!reused) {
564-
info(
563+
quarto.console.info(
565564
"No transport file was found after the timeout. This is the log from the server process:",
566565
);
567-
info("#### BEGIN LOG ####");
566+
quarto.console.info("#### BEGIN LOG ####");
568567
printJuliaServerLog();
569-
info("#### END LOG ####");
568+
quarto.console.info("#### END LOG ####");
570569
}
571570
throw err;
572571
}
573572

574573
if (!reused) {
575-
info("Julia server process started.");
574+
quarto.console.info("Julia server process started.");
576575
}
577576

578577
trace(
@@ -597,7 +596,7 @@ async function getJuliaServerConnection(
597596
safeRemoveSync(juliaTransportFile());
598597
return await getJuliaServerConnection(options);
599598
} else {
600-
error(
599+
quarto.console.error(
601600
"Connecting to server failed. A transport file was successfully created by the server process, so something in the server process might be broken.",
602601
);
603602
throw e;
@@ -739,7 +738,7 @@ async function executeJulia(
739738
update.source,
740739
Math.max(0, ncols - firstPartLength),
741740
);
742-
info(`${firstPart}${sigLine}`);
741+
quarto.console.info(`${firstPart}${sigLine}`);
743742
},
744743
);
745744

@@ -949,14 +948,14 @@ function juliaRuntimeDir(): string {
949948
try {
950949
return quarto.path.runtime("julia");
951950
} catch (e) {
952-
error("Could not create julia runtime directory.");
953-
error(
951+
quarto.console.error("Could not create julia runtime directory.");
952+
quarto.console.error(
954953
"This is possibly a permission issue in the environment Quarto is running in.",
955954
);
956-
error(
955+
quarto.console.error(
957956
"Please consult the following documentation for more information:",
958957
);
959-
error(
958+
quarto.console.error(
960959
"https://github.com/quarto-dev/quarto-cli/issues/4594#issuecomment-1619177667",
961960
);
962961
throw e;
@@ -973,7 +972,7 @@ export function juliaServerLogFile() {
973972

974973
function trace(options: ExecuteOptions, msg: string) {
975974
if (options.format?.execute[kExecuteDebug] === true) {
976-
info("- " + msg, { bold: true });
975+
quarto.console.info("- " + msg, { bold: true });
977976
}
978977
}
979978

@@ -1017,7 +1016,7 @@ function populateJuliaEngineCommand(command: Command) {
10171016
async function logStatus() {
10181017
const transportFile = juliaTransportFile();
10191018
if (!existsSync(transportFile)) {
1020-
info("Julia control server is not running.");
1019+
quarto.console.info("Julia control server is not running.");
10211020
return;
10221021
}
10231022
const transportOptions = await readTransportFile(transportFile);
@@ -1040,26 +1039,26 @@ async function logStatus() {
10401039

10411040
conn.close();
10421041
} else {
1043-
info(`Found transport file but can't connect to control server.`);
1042+
quarto.console.info(`Found transport file but can't connect to control server.`);
10441043
}
10451044
}
10461045

10471046
async function killJuliaServer() {
10481047
const transportFile = juliaTransportFile();
10491048
if (!existsSync(transportFile)) {
1050-
info("Julia control server is not running.");
1049+
quarto.console.info("Julia control server is not running.");
10511050
return;
10521051
}
10531052
const transportOptions = await readTransportFile(transportFile);
10541053
Deno.kill(transportOptions.pid, "SIGTERM");
1055-
info("Sent SIGTERM to server process");
1054+
quarto.console.info("Sent SIGTERM to server process");
10561055
}
10571056

10581057
function printJuliaServerLog() {
10591058
if (existsSync(juliaServerLogFile())) {
10601059
Deno.stdout.writeSync(Deno.readFileSync(juliaServerLogFile()));
10611060
} else {
1062-
info("Server log file doesn't exist");
1061+
quarto.console.info("Server log file doesn't exist");
10631062
}
10641063
return;
10651064
}
@@ -1107,13 +1106,13 @@ async function closeWorker(file: string, force: boolean) {
11071106
type: force ? "forceclose" : "close",
11081107
content: { file: absfile },
11091108
});
1110-
info(`Worker ${force ? "force-" : ""}closed successfully.`);
1109+
quarto.console.info(`Worker ${force ? "force-" : ""}closed successfully.`);
11111110
}
11121111

11131112
async function stopServer() {
11141113
const result = await connectAndWriteJuliaCommandToRunningServer({
11151114
type: "stop",
11161115
content: {},
11171116
});
1118-
info(result.message);
1117+
quarto.console.info(result.message);
11191118
}

0 commit comments

Comments
 (0)