DaskClusterFactory ================== Purpose ------- This is the recommended API for most users. The ``DaskClusterFactory`` chooses the right cluster implementation at runtime. It checks ``SLURM_JOB_ID`` to detect whether batchlet is running inside an existing SLURM allocation. * If ``SLURM_JOB_ID`` is set: it creates :py:class:`DaskSlurmCluster` and waits for all workers. * Otherwise: it creates a local dask cluster via :py:class:`DaskLocalCluster`. This makes application code portable across local development and SLURM-backed execution without changing cluster-creation logic. Usage ----- .. code-block:: python from ska_sdp_batchlet.utils.dask_cluster import DaskClusterFactory dask_params = { "workers_per_node": 2, "threads_per_worker": 2, "memory_per_worker": "4GB", "resources_per_worker": "GPU=1,CPU=2", } with DaskClusterFactory.get_cluster(dask_params) as cluster: client = cluster.get_client() # run dask code using client API --- .. autoclass:: ska_sdp_batchlet.utils.dask_cluster.factory.DaskClusterFactory :members: :no-index: