Skip to content

Reorganize blech_process.log to group by status#731

Open
abuzarmahmood wants to merge 4 commits into
katzlabbrandeis:masterfrom
abuzarmahmood:fix/issue-729-reorganize-process-log
Open

Reorganize blech_process.log to group by status#731
abuzarmahmood wants to merge 4 commits into
katzlabbrandeis:masterfrom
abuzarmahmood:fix/issue-729-reorganize-process-log

Conversation

@abuzarmahmood
Copy link
Copy Markdown
Member

@abuzarmahmood abuzarmahmood commented Feb 3, 2026

Summary

Restructures blech_process.log so the top-level keys are complete and attempted instead of electrode numbers. Also updates related log handling in other files.

Changes

  • blech_process.py: Log entries are now grouped under their status (complete or attempted)
    • When processing starts, electrode is added to attempted
    • On successful completion, electrode is moved from attempted to complete
    • Re-processing an electrode removes it from complete before adding to attempted
  • blech_run_process.sh: Updated to read incomplete electrodes from the new structure
  • utils/blech_utils.py: Updated pipeline_graph_check.write_to_log to remove script from attempted when marking as completed

New log structure

{
  "complete": {
    "0": {"start_time": "...", "end_time": "..."},
    "1": {"start_time": "...", "end_time": "..."}
  },
  "attempted": {
    "16": {"start_time": "..."},
    "17": {"start_time": "..."}
  }
}

Fixes #729

Restructure the log file so top-level keys are 'complete' and 'attempted'
instead of electrode numbers. Electrodes are now grouped under their
respective status, making it easier to see processing state at a glance.

Fixes katzlabbrandeis#729

Co-authored-by: Ona <no-reply@ona.com>
@abuzarmahmood
Copy link
Copy Markdown
Member Author

Solution Overview

The log file structure has been reorganized from a flat electrode-keyed format to a status-keyed format.

Before (flat structure)

{
  "0": {"start_time": "...", "status": "complete", "end_time": "..."},
  "16": {"start_time": "...", "status": "attempted"}
}

After (status-grouped structure)

{
  "complete": {
    "0": {"start_time": "...", "end_time": "..."}
  },
  "attempted": {
    "16": {"start_time": "..."}
  }
}

Implementation details

  1. Initialization: Creates complete and attempted top-level keys if they don't exist
  2. Processing start: Adds electrode to attempted (removes from complete if re-processing)
  3. Processing complete: Moves electrode from attempted to complete with end_time

This makes it easier to see at a glance which electrodes completed successfully vs which are still in progress or failed.

Read incomplete electrodes from 'attempted' key instead of iterating
all entries and checking status field.

Co-authored-by: Ona <no-reply@ona.com>
@abuzarmahmood
Copy link
Copy Markdown
Member Author

Added update to blech_run_process.sh to correctly read incomplete electrodes from the new log structure.

The completion check now reads from process_log.get('attempted', {}).keys() instead of iterating all entries and checking the status field.

Update pipeline_graph_check.write_to_log to remove the script from
'attempted' when adding it to 'completed', keeping the log structure
consistent.

Co-authored-by: Ona <no-reply@ona.com>
@abuzarmahmood
Copy link
Copy Markdown
Member Author

Added update to utils/blech_utils.py:

pipeline_graph_check.write_to_log now removes the script from attempted when marking it as completed, keeping the execution log structure consistent with the new pattern.

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.

reorganize blech_process.log to have top level be complete or attempted

1 participant