{"record":{"id":"bfca1540ec2d3909","repo":"mlflow/mlflow","slug":"asyncartifactsloggingqueue-is-not-activated","errorCode":null,"errorMessage":"AsyncArtifactsLoggingQueue is not activated.","messagePattern":"AsyncArtifactsLoggingQueue is not activated\\.","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/utils/async_logging/async_artifacts_logging_queue.py","lineNumber":203,"sourceCode":"        \"\"\"Asynchronously logs runs artifacts.\n\n        Args:\n            filename: Filename of the artifact to be logged.\n            artifact_path: Directory within the run's artifact directory in which to log the\n                artifact.\n            artifact: The artifact to be logged.\n\n        Returns:\n            mlflow.utils.async_utils.RunOperations: An object that encapsulates the\n                asynchronous operation of logging the artifact of run data.\n                The object contains a list of `concurrent.futures.Future` objects that can be used\n                to check the status of the operation and retrieve any exceptions\n                that occurred during the operation.\n        \"\"\"\n        from mlflow import MlflowException\n\n        if not self._is_activated:\n            raise MlflowException(\"AsyncArtifactsLoggingQueue is not activated.\")\n        artifact = RunArtifact(\n            filename=filename,\n            artifact_path=artifact_path,\n            artifact=artifact,\n            completion_event=threading.Event(),\n        )\n        self._queue.put(artifact)\n        operation_future = self._artifact_status_check_threadpool.submit(\n            self._wait_for_artifact, artifact\n        )\n        return RunOperations(operation_futures=[operation_future])\n\n    def is_active(self) -> bool:\n        return self._is_activated\n\n    def _set_up_logging_thread(self) -> None:\n        \"\"\"Sets up the logging thread.\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/utils/async_logging/async_artifacts_logging_queue.py#L185-L221","documentation":"AsyncArtifactsLoggingQueue.log_artifacts_async refuses to enqueue work when the queue has not been activated (`_is_activated` is False). Activation happens in `start()`; without it there is no consumer thread, so artifacts would never be uploaded. MLflow raises MlflowException to fail fast instead of silently dropping artifacts.","triggerScenarios":"Calling `log_artifacts_async` (or `_log_artifact_async` / `_send_artifact` paths) on an AsyncArtifactsLoggingQueue instance whose `start()` was never called, or after `stop()`/termination deactivated it.","commonSituations":"Instantiating AsyncArtifactsLoggingQueue manually instead of via the client's managed lifecycle; calling log_artifacts_async after the client shut down the queue; reusing a queue object across processes/after pickling without restarting it.","solutions":["Call `queue.start()` before the first `log_artifacts_async` call.","If using MlflowClient high-level API, let the client manage activation (log via client.log_artifact with async mode) rather than constructing the queue yourself.","If the queue was stopped, create a new AsyncArtifactsLoggingQueue and start it rather than restarting the old one.","Check `is_active()` before enqueueing and fall back to synchronous artifact logging when inactive."],"exampleFix":"# before\nqueue = AsyncArtifactsLoggingQueue()\nqueue.log_artifacts_async(run_id, \"model.pkl\", \"model\")\n\n# after\nqueue = AsyncArtifactsLoggingQueue()\nqueue.start()\nqueue.log_artifacts_async(run_id, \"model.pkl\", \"model\")","handlingStrategy":"validation","validationCode":"if not queue.is_active() if hasattr(queue, 'is_active') else not queue._is_activated:\n    queue.start()\nqueue.log_artifacts_async(run_id, filename, artifact_path, artifact)","typeGuard":"def is_queue_ready(queue) -> bool:\n    return bool(getattr(queue, \"_is_activated\", False))","tryCatchPattern":"from mlflow.exceptions import MlflowException\ntry:\n    queue.log_artifacts_async(run_id, filename, artifact_path, artifact)\nexcept MlflowException as e:\n    if \"not activated\" in str(e):\n        queue.start()\n        queue.log_artifacts_async(run_id, filename, artifact_path, artifact)\n    else:\n        raise","preventionTips":["Always call start() immediately after constructing AsyncArtifactsLoggingQueue.","Let MlflowClient manage the queue lifecycle instead of manual instantiation.","Never reuse a queue object after stop(); create a new one.","Check is_active() before every async enqueue in long-running services."],"tags":["async","lifecycle","artifacts","queue"],"backgroundTag":"queue-not-activated","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}