diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a541fd..6e600d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added minimal Run classes ([#6](https://github.com/neptune-ai/neptune-client-scale/pull/6)) +- Added support for `max_queue_size` and `max_queue_size_exceeded_callback` parameters in `Run` ([#7](https://github.com/neptune-ai/neptune-client-scale/pull/7)) diff --git a/src/neptune_scale/__init__.py b/src/neptune_scale/__init__.py index d874412f..f32720ec 100644 --- a/src/neptune_scale/__init__.py +++ b/src/neptune_scale/__init__.py @@ -40,8 +40,8 @@ def __init__( api_token: str, family: str, run_id: str, - queue_max_size: int = MAX_QUEUE_SIZE, - queue_max_size_exceeded_callback: Callable[[int, BaseException], None] | None = None, + max_queue_size: int = MAX_QUEUE_SIZE, + max_queue_size_exceeded_callback: Callable[[int, BaseException], None] | None = None, ) -> None: """ Initializes a run that logs the model-building metadata to Neptune. @@ -52,15 +52,15 @@ def __init__( family: Identifies related runs. For example, the same value must apply to all runs within a run hierarchy. Max length: 128 characters. run_id: Unique identifier of a run. Must be unique within the project. Max length: 128 characters. - queue_max_size: Maximum number of operations that can be queued before the queue is considered full. - queue_max_size_exceeded_callback: Callback function called when the queue is full. Accepts two arguments: + max_queue_size: Maximum number of operations that can be queued before the queue is considered full. + max_queue_size_exceeded_callback: Callback function called when the queue is full. Accepts two arguments: the maximum size of the queue and the exception that caused the queue to be full. """ verify_type("api_token", api_token, str) verify_type("family", family, str) verify_type("run_id", run_id, str) - verify_type("queue_max_size", queue_max_size, int) - verify_type("queue_max_size_exceeded_callback", queue_max_size_exceeded_callback, (Callable, type(None))) + verify_type("max_queue_size", max_queue_size, int) + verify_type("max_queue_size_exceeded_callback", max_queue_size_exceeded_callback, (Callable, type(None))) verify_non_empty("api_token", api_token) verify_non_empty("family", family) @@ -78,7 +78,7 @@ def __init__( self._lock = threading.RLock() self._operations_queue: OperationsQueue = OperationsQueue( - lock=self._lock, max_size=queue_max_size, max_size_exceeded_callback=queue_max_size_exceeded_callback + lock=self._lock, max_size=max_queue_size, max_size_exceeded_callback=max_queue_size_exceeded_callback ) def __enter__(self) -> Run: