dacapo.blockwise ================ .. py:module:: dacapo.blockwise Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/dacapo/blockwise/argmax_worker/index /autoapi/dacapo/blockwise/blockwise_task/index /autoapi/dacapo/blockwise/empanada_function/index /autoapi/dacapo/blockwise/predict_worker/index /autoapi/dacapo/blockwise/relabel_worker/index /autoapi/dacapo/blockwise/scheduler/index /autoapi/dacapo/blockwise/segment_worker/index /autoapi/dacapo/blockwise/threshold_worker/index /autoapi/dacapo/blockwise/watershed_function/index Classes ------- .. autoapisummary:: dacapo.blockwise.DaCapoBlockwiseTask Functions --------- .. autoapisummary:: dacapo.blockwise.run_blockwise dacapo.blockwise.segment_blockwise Package Contents ---------------- .. py:class:: DaCapoBlockwiseTask(worker_file: str | upath.UPath, total_roi: daisy.Roi, read_roi: daisy.Roi, write_roi: daisy.Roi, num_workers: int = 16, max_retries: int = 2, timeout=None, upstream_tasks=None, *args, **kwargs) A task to run a blockwise worker function. This task is used to run a blockwise worker function on a given ROI. .. attribute:: worker_file The path to the worker file. :type: str | Path .. attribute:: total_roi The ROI to process. :type: Roi .. attribute:: read_roi The ROI to read from for a block. :type: Roi .. attribute:: write_roi The ROI to write to for a block. :type: Roi .. attribute:: num_workers The number of workers to use. :type: int .. attribute:: max_retries The maximum number of times a task will be retried if failed (either due to failed post check or application crashes or network failure) :type: int .. attribute:: timeout The timeout for the task. .. attribute:: upstream_tasks The upstream tasks. .. attribute:: \*args Additional positional arguments to pass to ``worker_function``. .. attribute:: \*\*kwargs Additional keyword arguments to pass to ``worker_function``. .. method:: __init__ Initialize the task. .. py:attribute:: worker_name .. py:attribute:: worker .. py:attribute:: timestamp .. py:attribute:: task_id .. py:attribute:: process_function .. py:attribute:: read_write_conflict .. py:attribute:: fit .. py:attribute:: kwargs .. py:function:: run_blockwise(worker_file: str | upath.UPath, total_roi: funlib.geometry.Roi, read_roi: funlib.geometry.Roi, write_roi: funlib.geometry.Roi, num_workers: int = 16, max_retries: int = 1, timeout=None, upstream_tasks=None, *args, **kwargs) Run a function in parallel over a large volume. :param worker_file: The path to the file containing the necessary worker functions: ``spawn_worker`` and ``start_worker``. Optionally, the file can also contain a ``check_function`` and an ``init_callback_fn``. :type worker_file: ``str`` or ``Path`` :param total_roi: The ROI to process. :type total_roi: ``Roi`` :param read_roi: The ROI to read from for a block. :type read_roi: ``Roi`` :param write_roi: The ROI to write to for a block. :type write_roi: ``Roi`` :param num_workers: The number of workers to use. :type num_workers: ``int`` :param max_retries: The maximum number of times a task will be retried if failed (either due to failed post check or application crashes or network failure) :type max_retries: ``int`` :param \*args: Additional positional arguments to pass to ``worker_function``. :param \*\*kwargs: Additional keyword arguments to pass to ``worker_function``. :returns: ``Bool``. .. rubric:: Examples >>> run_blockwise(worker_file, total_roi, read_roi, write_roi, num_workers, max_retries, timeout, upstream_tasks) .. py:function:: segment_blockwise(segment_function_file: str | upath.UPath, context: funlib.geometry.Coordinate, total_roi: funlib.geometry.Roi, read_roi: funlib.geometry.Roi, write_roi: funlib.geometry.Roi, num_workers: int = 16, max_retries: int = 2, timeout=None, upstream_tasks=None, keep_tmpdir=False, *args, **kwargs) Run a segmentation function in parallel over a large volume. :param segment_function_file: The path to the file containing the necessary worker functions: ``spawn_worker`` and ``start_worker``. Optionally, the file can also contain a ``check_function`` and an ``init_callback_fn``. :type segment_function_file: ``str`` or ``Path`` :param context: The context to add to the read and write ROI. :type context: ``Coordinate`` :param total_roi: The ROI to process. :type total_roi: ``Roi`` :param read_roi: The ROI to read from for a block. :type read_roi: ``Roi`` :param write_roi: The ROI to write to for a block. :type write_roi: ``Roi`` :param num_workers: The number of workers to use. :type num_workers: ``int`` :param max_retries: The maximum number of times a task will be retried if failed (either due to failed post check or application crashes or network failure) :type max_retries: ``int`` :param timeout: The maximum time in seconds to wait for a worker to complete a task. :type timeout: ``int`` :param upstream_tasks: List of upstream tasks. :type upstream_tasks: ``List`` :param keep_tmpdir: Whether to keep the temporary directory. :type keep_tmpdir: ``bool`` :param \*args: Additional positional arguments to pass to ``worker_function``. :param \*\*kwargs: Additional keyword arguments to pass to ``worker_function``. :returns: ``Bool``. .. rubric:: Examples >>> segment_blockwise(segment_function_file, context, total_roi, read_roi, write_roi, num_workers, max_retries, timeout, upstream_tasks)