Skip to content

Commit 2a141f8

Browse files
committed
Debug
1 parent 5294580 commit 2a141f8

File tree

2 files changed

+47
-44
lines changed

2 files changed

+47
-44
lines changed

.github/workflows/reth-benchmark.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ jobs:
326326
run: |
327327
mkdir -p rpc-cache
328328
mkdir -p ${METRIC_PREFIX}
329+
ls ${PARAMS_DIR}
329330
RPC_1=${{ secrets.RPC_URL_1 }}
330331
MODE=${{ inputs.mode || github.event.inputs.mode }}
331332
BLOCK_NUMBER=${{ inputs.block_number || github.event.inputs.block_number }}
Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,77 @@
1-
const { spawn } = require('child_process');
2-
const fs = require('fs');
1+
const { spawn } = require("child_process");
2+
const fs = require("fs");
33

44
const urlRegex = /(https:\/\/profiler\.firefox\.com[^\s]+)/;
55

66
function runScript() {
77
// Script must be run from the root of the repository
8-
if (!fs.existsSync('rust-toolchain.toml')) {
9-
console.error('Error: This script must be run from the repository root');
8+
if (!fs.existsSync("rust-toolchain.toml")) {
9+
console.error("Error: This script must be run from the repository root");
1010
process.exit(1);
1111
}
1212

1313
// Get the shell script path from command line arguments, or use default
1414
if (process.argv.length < 3) {
15-
console.error('Error: Please provide the path to the shell script (from repo root) that runs `samply record` as the first argument');
15+
console.error(
16+
"Error: Please provide the path to the shell script (from repo root) that runs `samply record` as the first argument"
17+
);
1618
process.exit(1);
1719
}
1820
const shellScriptPath = process.argv[2];
19-
21+
2022
// Get the metric name from command line arguments, or use default `profile` name
21-
const metricName = process.argv[3] || "profile";
22-
23+
const metricName = process.argv[3] || "profile";
24+
2325
// Spawn the shell script process
24-
const shellProcess = spawn('sh', [shellScriptPath], {
25-
stdio: ['inherit', 'pipe', 'pipe']
26+
const shellProcess = spawn("sh", [shellScriptPath], {
27+
stdio: ["inherit", "pipe", "pipe"],
2628
});
2729

2830
// Listen for data on stdout
29-
shellProcess.stdout.on('data', (data) => {
31+
shellProcess.stdout.on("data", (data) => {
3032
const output = data.toString();
31-
process.stdout.write(output)
33+
process.stdout.write(output);
3234

3335
// Check if the output contains a URL and we haven't processed it yet
3436
const match = output.match(urlRegex);
3537
if (match) {
3638
const url = match[1];
37-
const urlData = url.split('127.0.0.1%3A')[1].split('%2F');
39+
const urlData = url.split("127.0.0.1%3A")[1].split("%2F");
3840
const port = urlData[0];
3941
const id = urlData[1];
4042
const serverUrl = `http://localhost:${port}/${id}`;
41-
console.log('server url:', serverUrl);
43+
console.log("server url:", serverUrl);
4244

43-
let folder = metricName.split('/')[0];
45+
let folder = metricName.split("/")[0];
4446

4547
// Wait for the shell script to complete before running follow-up commands
4648
const commands = [
4749
{
48-
cmd: 'gzip',
49-
args: ['-d', '-f', 'profile.json.gz'],
50+
cmd: "gzip",
51+
args: ["-d", "-f", "profile.json.gz"],
5052
},
5153
{
52-
cmd: 'mv',
53-
args: ['profile.json', `${metricName}.json`],
54+
cmd: "mv",
55+
args: ["profile.json", `${metricName}.json`],
5456
},
5557
{
56-
cmd: 'sleep',
57-
args: ['5'],
58+
cmd: "sleep",
59+
args: ["5"],
5860
},
61+
// {
62+
// cmd: 'ls',
63+
// args: ['-lFa', folder],
64+
// },
5965
{
60-
cmd: 'ls',
61-
args: ['-lFa', folder],
62-
},
63-
{
64-
cmd: 'node',
66+
cmd: "node",
6567
args: [
66-
'bin/symbolicate/symbolicator-cli/symbolicator-cli.js',
67-
'--input',
68+
"bin/symbolicate/symbolicator-cli/symbolicator-cli.js",
69+
"--input",
6870
`${metricName}.json`,
69-
'--output',
71+
"--output",
7072
`${metricName}-symbolicated.json`,
71-
'--server',
72-
serverUrl
73+
"--server",
74+
serverUrl,
7375
],
7476
},
7577
];
@@ -79,24 +81,24 @@ function runScript() {
7981

8082
const command = commands[index];
8183
const nextCommand = spawn(command.cmd, command.args, {
82-
stdio: ['inherit', 'pipe', 'pipe'],
84+
stdio: ["inherit", "pipe", "pipe"],
8385
});
8486

85-
nextCommand.stdout.on('data', (data) => {
87+
nextCommand.stdout.on("data", (data) => {
8688
const output = data.toString();
8789
process.stdout.write(output);
88-
if (output.includes('Finished.')) {
89-
console.log('Exiting symbolicator.');
90+
if (output.includes("Finished.")) {
91+
console.log("Exiting symbolicator.");
9092
process.exit(0);
9193
}
9294
});
9395

94-
nextCommand.on('error', (error) => {
95-
console.error('Failed to execute command:', error);
96+
nextCommand.on("error", (error) => {
97+
console.error("Failed to execute command:", error);
9698
process.exit(1);
9799
});
98100

99-
nextCommand.on('close', (code) => {
101+
nextCommand.on("close", (code) => {
100102
if (code === 0) {
101103
// Run next command only if current command succeeded
102104
executeSequential(commands, index + 1);
@@ -112,14 +114,14 @@ function runScript() {
112114
});
113115

114116
// Handle errors
115-
shellProcess.stderr.on('data', (data) => {
116-
process.stderr.write(`${data}`);
117+
shellProcess.stderr.on("data", (data) => {
118+
process.stderr.write(`${data}`);
117119
});
118120

119-
shellProcess.on('error', (error) => {
120-
console.error('Failed to start shell script:', error);
121-
process.exit(1);
121+
shellProcess.on("error", (error) => {
122+
console.error("Failed to start shell script:", error);
123+
process.exit(1);
122124
});
123125
}
124126

125-
runScript();
127+
runScript();

0 commit comments

Comments
 (0)