Skip to content

Conversation

@mzouink
Copy link
Member

@mzouink mzouink commented Sep 2, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 2, 2025 16:19
@mzouink
Copy link
Member Author

mzouink commented Sep 2, 2025

addressing #67

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the blockwise fly model processing by adding configurable input/output sizes, improving error handling, and implementing progress tracking for better reliability and monitoring.

  • Added configurable input and output sizes for model processing
  • Implemented progress tracking using temporary files to avoid reprocessing completed blocks
  • Enhanced error handling in block processing with try-catch blocks and improved logging

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cellmap_flow/cli/fly_model.py Added configurable input_size and output_size parameters with defaults
cellmap_flow/blockwise/blockwise_processor.py Enhanced with progress tracking, error handling, and check function for completed blocks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +61 to +62
# Added and create == True to fix client error when create: True in the yaml, so when it is a client it will not be changed
if "create" in self.config and create == True:
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

Use is True instead of == True for boolean comparison, or simply use and create since the parameter is already a boolean.

Suggested change
# Added and create == True to fix client error when create: True in the yaml, so when it is a client it will not be changed
if "create" in self.config and create == True:
if "create" in self.config and create:

Copilot uses AI. Check for mistakes.
Comment on lines +243 to +244
def check_block(tmp_dir, block: daisy.Block) -> bool:
return (tmp_dir / f"{block.block_id[1]}").exists()
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

The function accesses block.block_id[1] without validation. Consider adding a check to ensure the block_id has at least 2 elements to prevent IndexError.

Suggested change
def check_block(tmp_dir, block: daisy.Block) -> bool:
return (tmp_dir / f"{block.block_id[1]}").exists()
if hasattr(block, "block_id") and isinstance(block.block_id, (list, tuple)) and len(block.block_id) > 1:
return (tmp_dir / f"{block.block_id[1]}").exists()
else:
logger.warning(f"Block id does not have at least 2 elements: {getattr(block, 'block_id', None)}")
return False

Copilot uses AI. Check for mistakes.

block.status = daisy.BlockStatus.SUCCESS
block.status = daisy.BlockStatus.SUCCESS
(self.tmp_dir / f"{block.block_id[1]}").touch()
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

Similar to the check_block function, this accesses block.block_id[1] without validation. Consider adding a check to ensure the block_id has sufficient elements.

Suggested change
(self.tmp_dir / f"{block.block_id[1]}").touch()
if hasattr(block, "block_id") and isinstance(block.block_id, (list, tuple)) and len(block.block_id) > 1:
(self.tmp_dir / f"{block.block_id[1]}").touch()
else:
logger.error(f"Block {block} has insufficient block_id elements: {block.block_id}")

Copilot uses AI. Check for mistakes.
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