Skip to content

[codex] Simplify flmexec new API usage#457

Merged
k82cn merged 1 commit into
xflops:mainfrom
k82cn:flmexec_new_api
May 16, 2026
Merged

[codex] Simplify flmexec new API usage#457
k82cn merged 1 commit into
xflops:mainfrom
k82cn:flmexec_new_api

Conversation

@k82cn
Copy link
Copy Markdown
Contributor

@k82cn k82cn commented May 16, 2026

Summary

  • remove flmexec's explicit config option and default-context connection setup
  • switch the flmexec client to flame::create_session and ssn.invoke task handles
  • convert flmexec-service to a typed flame::entrypoint and shared FlameMessage payloads
  • remove now-unused flmexec direct dependencies

Verification

  • cargo fmt --all -- --check
  • cargo check -p flmexec
  • cargo clippy -p flmexec --all-targets --all-features -- -D warnings
  • cargo test -p flmexec
  • cargo run -p flmexec --bin flmexec -- --help
  • git diff --check

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the flmexec service and client to utilize the new flame-rs macro-based entrypoint and invocation API, significantly simplifying the codebase. Key changes include replacing the FlameService trait implementation with a #[flame::entrypoint] function, moving ScriptRuntime to the script module, and removing several unused dependencies such as tonic and serde_json. In the client, the TaskInformer logic was replaced with direct task invocation. Feedback indicates that the use of try_join_all for waiting on tasks reduces resilience compared to the previous implementation, as a single failure will stop all output; switching to join_all is suggested to handle individual task results independently.

Comment thread flmexec/src/client.rs
Comment on lines +84 to 92
let outputs = try_join_all(handles).await?;

for (task_id, output) in task_ids.into_iter().zip(outputs) {
println!(
"Task {:<10}: {:?}",
task_id,
output.map(|output| output.data).unwrap_or_default()
);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using try_join_all to wait for task completion causes the entire operation to fail and exit if any single task encounters an error. This results in the loss of output for all other tasks, including those that may have completed successfully. The previous implementation using TaskInformer was more resilient, as it printed results for each task as they finished regardless of other task failures. Consider using futures::future::join_all to wait for all tasks and handle individual successes and failures independently.

    let outputs = futures::future::join_all(handles).await;

    for (task_id, output) in task_ids.into_iter().zip(outputs) {
        match output {
            Ok(output) => {
                println!(
                    "Task {:<10}: {:?}",
                    task_id,
                    output.map(|output| output.data).unwrap_or_default()
                );
            }
            Err(e) => {
                println!("Task {:<10}: Failed with error: {e}", task_id);
            }
        }
    }

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
flmexec/src/service.rs 0.00% 9 Missing ⚠️
flmexec/src/client.rs 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@k82cn k82cn merged commit b11f918 into xflops:main May 16, 2026
6 checks passed
@k82cn k82cn deleted the flmexec_new_api branch May 16, 2026 21:56
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.

1 participant