Skip to content

Conversation

daquinteroflex
Copy link
Collaborator

@daquinteroflex daquinteroflex commented Aug 22, 2025

Greptile Summary

This PR standardizes the batch web status names used in the RF/component modeler API from mixed PascalCase/CamelCase formats to consistent snake_case naming. The changes update three key files that handle RF batch task operations:

  1. Status Enum Definition: The BatchStatus enum in task_info.py has been completely updated with all 14 status values converted from formats like Created, Validate_Success, Run_Failed to draft, validate_success, run_failed respectively.

  2. Task Management Logic: The BatchTask class methods in task_core.py that monitor validation and execution progress have been updated to check for the new snake_case status values in their conditional logic.

  3. Web API Integration: The webapi.py file has been systematically updated across all RF batch-related functions to use the new status naming convention for validation checks, error handling, progress monitoring, and postprocessing triggers.

This change aligns the client-side code with updated backend API expectations that now return status values in snake_case format. The update ensures proper communication between the Tidy3D web client and the RF batch processing services. Some statuses have been consolidated (e.g., Run_Divergeddiverged) and refined (e.g., Createddraft, Abortaborting) to better represent the actual task states.

Important Files Changed
Filename Score Overview
tidy3d/web/core/task_info.py 4/5 Updated BatchStatus enum from PascalCase to snake_case format for all 14 status values
tidy3d/web/core/task_core.py 4/5 Modified status checking logic in BatchTask validation and execution methods to use new snake_case status names
tidy3d/web/api/webapi.py 5/5 Systematically updated all RF batch status checks throughout web API functions to match new naming convention

Confidence score: 4/5

  • This PR is generally safe to merge as it's primarily a naming convention update with consistent changes across related files
  • Score reflects the systematic nature of changes but potential risk if backend coordination is incomplete or if external dependencies rely on old status names
  • Pay close attention to ensuring backend API alignment and verify that all status references have been updated consistently

Sequence Diagram

sequenceDiagram
    participant User
    participant webapi
    participant SimulationTask
    participant BatchTask
    participant Server
    
    User->>webapi: "run(simulation, task_name)"
    webapi->>webapi: "upload(simulation, task_name)"
    webapi->>SimulationTask: "create(task_type='RF')"
    SimulationTask->>Server: "POST /projects/{folder_id}/tasks"
    Server-->>SimulationTask: "return task with batchId/groupId"
    SimulationTask-->>webapi: "return task_id (batch_id)"
    
    webapi->>webapi: "start(task_id)"
    webapi->>webapi: "_is_modeler_batch(task_id)"
    webapi->>BatchTask: "new BatchTask(task_id)"
    webapi->>Server: "POST /terminal-component-modeler-split"
    Server-->>webapi: "split response with child tasks"
    
    webapi->>BatchTask: "check(solver_version, batch_type='RF_SWEEP')"
    BatchTask->>Server: "POST /projects/{batch_id}/batch-check"
    Server-->>BatchTask: "validation response"
    
    webapi->>BatchTask: "wait_for_validate(batch_type='RF_SWEEP')"
    BatchTask->>BatchTask: "detail(batch_type='RF_SWEEP')"
    BatchTask->>Server: "GET /tasks/{batch_id}/batch-detail"
    Server-->>BatchTask: "BatchDetail with status"
    
    alt status is validate_success or validate_warn
        webapi->>BatchTask: "submit(batch_type='RF_SWEEP')"
        BatchTask->>Server: "POST /projects/{batch_id}/batch-submit"
        Server-->>BatchTask: "submit confirmation"
    else status is blocked/error
        webapi->>webapi: "raise WebError with status reason"
    end
    
    webapi->>webapi: "monitor(task_id)"
    webapi->>webapi: "_monitor_modeler_batch(batch_id)"
    
    loop monitoring batch progress
        webapi->>BatchTask: "detail(batch_type='RF_SWEEP')"
        BatchTask->>Server: "GET /tasks/{batch_id}/batch-detail"
        Server-->>BatchTask: "BatchDetail with updated status"
        webapi->>webapi: "update progress bars for validate/run/postprocess"
        
        alt run completed but postprocess not triggered
            webapi->>BatchTask: "postprocess(batch_type='RF_SWEEP')"
            BatchTask->>Server: "POST /projects/{batch_id}/postprocess"
        end
        
        alt status is terminal error
            webapi->>webapi: "raise WebError"
        else status is success
            webapi->>webapi: "break monitoring loop"
        end
    end
    
    webapi->>webapi: "load(task_id, path)"
    webapi->>webapi: "download(task_id, path)"
    webapi->>BatchTask: "get_data_hdf5(remote_data_file_gz='cm_data.hdf5.gz')"
    BatchTask->>Server: "download batch results"
    Server-->>BatchTask: "simulation data"
    BatchTask-->>webapi: "downloaded file path"
    webapi-->>User: "SimulationDataType results"
Loading

@daquinteroflex daquinteroflex changed the title Update web status names Update batch web status names Aug 22, 2025
@daquinteroflex daquinteroflex marked this pull request as ready for review August 25, 2025 07:44
@daquinteroflex daquinteroflex merged commit eb4cbc9 into dario/rf_endpoints_update Aug 25, 2025
@daquinteroflex daquinteroflex deleted the dario/rf_web_status_updates branch August 25, 2025 07:44
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@daquinteroflex
Copy link
Collaborator Author

Reverting until we're ready in the backend

daquinteroflex added a commit that referenced this pull request Aug 25, 2025
daquinteroflex added a commit that referenced this pull request Aug 25, 2025
@daquinteroflex daquinteroflex restored the dario/rf_web_status_updates branch August 25, 2025 10:19
daquinteroflex added a commit that referenced this pull request Aug 26, 2025
* Update web status

* Minor fixs

* Final typo
daquinteroflex added a commit that referenced this pull request Aug 26, 2025
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.

2 participants