Skip to content

Commit

Permalink
feat: 💥 Add blockwise prediction, callable from cli.
Browse files Browse the repository at this point in the history
Added ability to call dacapo.predict from command line. This implements a blockwise-parallelized operation, with specific implementation depending on the ComputeContext. This feature came with the development of the basis for the blockwise processing infrastructure within dacapo.

The function signature of dacapo.predict has changed significantly. apply.py and any other functions/scripts referring to it will no longer function and will need to be converted to the new call structure.
  • Loading branch information
rhoadesScholar committed Feb 14, 2024
1 parent 48de078 commit 6820aa8
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 335 deletions.
2 changes: 1 addition & 1 deletion dacapo/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def apply_run(
input_array,
prediction_array_identifier,
output_roi=roi,
num_cpu_workers=num_cpu_workers,
num_workers=num_cpu_workers,
output_dtype=output_dtype,
compute_context=compute_context,
overwrite=overwrite,
Expand Down
1 change: 1 addition & 0 deletions dacapo/blockwise/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .blockwise_task import DaCapoBlockwiseTask
from .scheduler import run_blockwise
6 changes: 5 additions & 1 deletion dacapo/blockwise/blockwise_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from typing import Callable, Optional
from daisy import Task, Roi
from dacapo.compute_context import ComputeContext, LocalTorch, Bsub
import dacapo.compute_context


class DaCapoBlockwiseTask(Task):
def __init__(
self,
worker_file: str or Path,
compute_context: ComputeContext,
compute_context: ComputeContext or str,
total_roi: Roi,
read_roi: Roi,
write_roi: Roi,
Expand All @@ -21,6 +22,9 @@ def __init__(
*args,
**kwargs
):
if isinstance(compute_context, str):
compute_context = getattr(dacapo.compute_context, compute_context)()

# Make the task_id unique
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
task_id = worker_file + timestamp
Expand Down
Loading

0 comments on commit 6820aa8

Please sign in to comment.