- 
                Notifications
    You must be signed in to change notification settings 
- Fork 77
          Add llm-transpile command with Switch runner and integration tests
          #2078
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/switch-installer-integration
Are you sure you want to change the base?
  
    Add llm-transpile command with Switch runner and integration tests
  
  #2078
              Conversation
| ✅ 46/46 passed, 6 flaky, 3m12s total Flaky tests: 
 Running from acceptance #2812 | 
804507e    to
    d884a20      
    Compare
  
    Implement llm-transpile command for LLM-based code transpilation: - Add SwitchInstaller for Switch transpiler package management - Install Switch package and deploy to workspace - Create and manage Databricks jobs with job-level parameters - Configure Switch resources (catalog, schema, volume) - Add SwitchRunner for executing Switch transpilation jobs - Upload source files to workspace volume - Execute transpilation via Databricks job - Download results and handle job lifecycle - Add llm-transpile CLI command with Switch transpiler support - Add comprehensive unit and integration tests
Move _get_switch_package_path() from WorkspaceInstallation to SwitchDeployment as a protected method, following Single Responsibility Principle. SwitchDeployment now resolves its own package path internally. Changes: - Add _get_switch_package_path() protected method to SwitchDeployment - Update SwitchDeployment.install() signature to remove path parameter - Remove duplicate _get_switch_package_path() from WorkspaceInstallation - Remove unused sys and TranspilerRepository imports from installation.py - Update tests to use new interface with mocked path resolution
Update test_installation.py to match the refactored SwitchDeployment.install() interface that now takes only resources parameter (path resolution is internal). Changes: - Remove switch_repository fixture parameter from test methods - Delete unused _StubTranspilerRepository stub class - Remove unused imports (Path, TranspilerRepository) - Update assertions to check only resources argument The tests verify that: 1. Switch installation uses configured resources correctly 2. Missing resources logs appropriate error message
4f551ce    to
    bacd5f6      
    Compare
  
    Sync with main branch to incorporate latest documentation updates # Conflicts: # labs.yml
The wait_for_completion option is intended for local CLI execution only and should not be included in Databricks job parameters. This change filters it out when building job parameter definitions. Changes: - Add excluded_options set to filter local-only options - Skip wait_for_completion when converting config.yml options - Add test using FriendOfSwitchDeployment pattern to verify exclusion
…ntrol Add test_switch_install_with_transpile for full workflow testing including job execution and output verification. Test automatically skips without LAKEBRIDGE_SWITCH_E2E=true environment variable. Refactor existing test to test_switch_install and extract helper functions for DRY implementation. All changes in single file with no CI impact.
…que suffix generation
Merged latest changes from main branch including: - Profiler skeleton and Synapse profiler scripts - Transpiler product_name to transpiler_id rename - Additional transpile command arguments support - Test improvements for MSSQL and transpiler repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| ) -> None: | ||
| """Transpile source code to Databricks using LLM Transpiler (Switch)""" | ||
| ctx = ApplicationContext(w) | ||
| ctx.add_user_agent_extra("cmd", "llm-transpile") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ctx.add_user_agent_extra("cmd", "llm-transpile") | |
| ctx.add_user_agent_extra("cmd", "switch") | 
| from databricks.labs.lakebridge.transpiler.switch_runner import SwitchConfig, SwitchRunner | ||
|  | ||
|  | ||
| class FriendOfSwitchRunner(SwitchRunner): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class FriendOfSwitchRunner(SwitchRunner): | |
| class MockSwitchRunner(SwitchRunner): | 
| - name: interactive | ||
| description: "Whether installing in interactive mode, which may prompt for configuration settings." | ||
| default: auto | ||
| - name: include-llm-transpiler | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confused why this is here in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if ctx is None: | ||
| ctx = ApplicationContext(w) | ||
| del w | ||
| ctx.add_user_agent_extra("cmd", "transpile-switch") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the command is llm-transpile
Changes
This PR adds the
llm-transpilecommand for LLM-powered SQL conversion using the Switch transpiler.What does this PR do?
Adds
llm-transpileCLI command that runs Switch transpiler jobs with parameter passing support.Relevant implementation details
CLI Integration:
llm-transpilecommand to Lakebridge CLISwitch Runner Implementation:
SwitchConfig: manages Switch resources and job ID retrieval from InstallStateSwitchRunner: orchestrates Switch job execution with parametersTesting:
Development Environment:
.envto.gitignorefor local development credentialsCaveats/things to watch out for when reviewing:
transpileandreconcommand patternsreconpattern)--output-ws-folder(not--output-folder) to explicitly indicate workspace folder--include-llm-transpilerflag #2066 (Switch installation) to be merged firstLinked issues
Resolves #2047
Functionality
databricks labs lakebridge llm-transpileTests