diff --git a/docs/Parameters.rst b/docs/Parameters.rst index 678b7e95d66b..54fc66b2361a 100644 --- a/docs/Parameters.rst +++ b/docs/Parameters.rst @@ -1137,7 +1137,7 @@ Network Parameters - this parameter is needed to be set in both **socket** and **mpi** versions -- ``local_listen_port`` :raw-html:`🔗︎`, default = ``12400``, type = int, aliases: ``local_port``, ``port``, constraints: ``local_listen_port > 0`` +- ``local_listen_port`` :raw-html:`🔗︎`, default = ``12400 (random for Dask-package)``, type = int, aliases: ``local_port``, ``port``, constraints: ``local_listen_port > 0`` - TCP listen port for local machines diff --git a/include/LightGBM/config.h b/include/LightGBM/config.h index b3b46b05656b..977c96af42f1 100644 --- a/include/LightGBM/config.h +++ b/include/LightGBM/config.h @@ -966,6 +966,7 @@ struct Config { int num_machines = 1; // check = >0 + // default = 12400 (random for Dask-package) // alias = local_port, port // desc = TCP listen port for local machines // desc = **Note**: don't forget to allow this port in firewall settings before training diff --git a/python-package/lightgbm/dask.py b/python-package/lightgbm/dask.py index 4404d3e0c357..6d3f008bc9e8 100644 --- a/python-package/lightgbm/dask.py +++ b/python-package/lightgbm/dask.py @@ -556,16 +556,6 @@ def _predict( raise TypeError('Data must be either Dask Array or Dask DataFrame. Got %s.' % str(type(data))) -# relying on the default port being 12400 in a firewall-constrained environment will -# not work because by default the Dask interface searches for ports randomly to reduce the overhead of network setup -_dasklgbmmodel_doc_network_params_warning = ( - ' ' * 4 + '.. warning::\n' - + '\n' - + ' ' * 16 + 'If communication between the workers in your Dask cluster is constrained by firewall rules, set ``machines`` or ``local_listen_port`` explicitly. \n' - + ' ' * 16 + 'If these are missing, LightGBM will use random open ports for communication between workers.\n' -) - - class _DaskLGBMModel: @property @@ -708,9 +698,7 @@ def __init__( # the note on custom objective functions in LGBMModel.__init__ is not # currently relevant for the Dask estimators - _base_doc = _base_doc[:_base_doc.find('Note\n')] - - __init__.__doc__ = _base_doc + _dasklgbmmodel_doc_network_params_warning + __init__.__doc__ = _base_doc[:_base_doc.find('Note\n')] def __getstate__(self) -> Dict[Any, Any]: return self._lgb_getstate() @@ -861,9 +849,7 @@ def __init__( # the note on custom objective functions in LGBMModel.__init__ is not # currently relevant for the Dask estimators - _base_doc = _base_doc[:_base_doc.find('Note\n')] - - __init__.__doc__ = _base_doc + _dasklgbmmodel_doc_network_params_warning + __init__.__doc__ = _base_doc[:_base_doc.find('Note\n')] def __getstate__(self) -> Dict[Any, Any]: return self._lgb_getstate() @@ -995,9 +981,7 @@ def __init__( # the note on custom objective functions in LGBMModel.__init__ is not # currently relevant for the Dask estimators - _base_doc = _base_doc[:_base_doc.find('Note\n')] - - __init__.__doc__ = _base_doc + _dasklgbmmodel_doc_network_params_warning + __init__.__doc__ = _base_doc[:_base_doc.find('Note\n')] def __getstate__(self) -> Dict[Any, Any]: return self._lgb_getstate()