Skip to content

Add profiling timestamps#47

Closed
jsk11235 wants to merge 7 commits intomainfrom
add-profiling-timestamps
Closed

Add profiling timestamps#47
jsk11235 wants to merge 7 commits intomainfrom
add-profiling-timestamps

Conversation

@jsk11235
Copy link
Copy Markdown
Collaborator

No description provided.

jacobkirmayer-imbue and others added 7 commits February 18, 2026 15:55
- Add profiling module with global start time and profile_log! macro
- Log elapsed time at key events in main.rs, orchestrator.rs
- Pass start time to Python scripts via OFFLOAD_START_TIME_NANOS env var
- Update modal_sandbox.py to use profile_log for consistent timing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- profiling.rs: Write timing logs to offload-timing.log file
- modal.rs: Add profile_log for create_sandbox and exec_stream
- default.rs: Add profile_log for create_sandbox and exec_stream

Logs use [creating] before sandbox exists, then [sandbox_id] after.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add optional exec_barrier field to TestRunner
- Barrier waits after exec is fired off but before results are awaited
- This ensures all Python processes are started before any output is read
- Useful for profiling true parallel execution latency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vet found 4 issues.


[commit_message_mismatch] (severity 3/5) (confidence 0.90)

The diff includes the offload-timing.log file with 268 lines of actual profiling output data committed to the repository. This is a generated artifact/log file that should not be committed - it should be in .gitignore. The user asked to 'add profiling timestamps' (i.e., add the instrumentation code), not to commit log output.

cmd_type = "pytest" if is_pytest else "other"
profile_log("[%s] modal: exec called (type=%s)", sandbox_id, cmd_type)
sandbox = modal.Sandbox.from_id(sandbox_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[commit_message_mismatch] (severity 3/5) (confidence 0.85)

The diff adds a junit_suite_name injection feature in the Python exec_command that modifies pytest commands to include sandbox_id as a junit prefix. This is unrelated to 'adding profiling timestamps' and constitutes an unauthorized behavioral change to test execution.

.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos()
- start.elapsed().as_nanos();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[instruction_file_disobeyed] (severity 3/5) (confidence 0.85)

The STYLE_GUIDE.md states 'Unsafe is forbidden by default' and requires #![forbid(unsafe_code)] at crate roots. The new src/profiling.rs module uses unsafe { std::env::set_var(...) } without any documented waiver or justification beyond a comment.

let file = OpenOptions::new()
.create(true)
.append(true)
.open("offload-timing.log")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[instruction_file_disobeyed] (severity 3/5) (confidence 0.95)

The STYLE_GUIDE.md states 'Do not use unwrap() / expect() in production code.' The new src/profiling.rs uses .expect() when opening the timing log file and .unwrap() when computing the epoch time.

@@ -0,0 +1,268 @@
14:09:30.713 [ 1.773s] modal: prepare called
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't want to commit this--and add it to .gitignore

@jsk11235
Copy link
Copy Markdown
Collaborator Author

Done with these profiling experiments for now, closing

@jsk11235 jsk11235 closed this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants