diff --git a/agenta-backend/agenta_backend/services/logs_manager.py b/agenta-backend/agenta_backend/services/logs_manager.py index d36437e7bc..4aabd1062a 100644 --- a/agenta-backend/agenta_backend/services/logs_manager.py +++ b/agenta-backend/agenta_backend/services/logs_manager.py @@ -6,30 +6,33 @@ def retrieve_cloudwatch_logs(function_app_id: str): - log_group_name = f"/aws/lambda/app-{function_app_id}" - - # Describe log streams to get the newest log stream - response = client.describe_log_streams( - logGroupName=log_group_name, orderBy="lastEventTimestamp", descending=True, limit=1 - ) - - if "logStreams" in response and len(response["logStreams"]) > 0: - newest_log_stream = response["logStreams"][0]["logStreamName"] - - # Get log events of the newest log stream - log_events_response = client.get_log_events( - logGroupName=log_group_name, logStreamName=newest_log_stream - ) - if "events" in log_events_response: - response_data = {} - list_of_events_messages = [] - for event in log_events_response["events"]: - list_of_events_messages.append(event["message"]) - - response_data["message"] = "Log events found in the newest log stream" - response_data["data"] = list_of_events_messages - return response_data - else: - return "No log events found in the newest log stream" - else: - return "No log streams found in the log group." + log_group_name = f"/aws/lambda/app-{function_app_id}" + + # Describe log streams to get the newest log stream + response = client.describe_log_streams( + logGroupName=log_group_name, + orderBy="lastEventTimestamp", + descending=True, + limit=1, + ) + + if "logStreams" in response and len(response["logStreams"]) > 0: + newest_log_stream = response["logStreams"][0]["logStreamName"] + + # Get log events of the newest log stream + log_events_response = client.get_log_events( + logGroupName=log_group_name, logStreamName=newest_log_stream + ) + if "events" in log_events_response: + response_data = {} + list_of_events_messages = [] + for event in log_events_response["events"]: + list_of_events_messages.append(event["message"]) + + response_data["message"] = "Log events found in the newest log stream" + response_data["data"] = list_of_events_messages + return response_data + else: + return "No log events found in the newest log stream" + else: + return "No log streams found in the log group." diff --git a/agenta-cli/agenta/client/client.py b/agenta-cli/agenta/client/client.py index 6f7b44432e..5a453fa8a7 100644 --- a/agenta-cli/agenta/client/client.py +++ b/agenta-cli/agenta/client/client.py @@ -526,7 +526,9 @@ def retrieve_user_id(host: str, api_key: Optional[str] = None) -> str: raise APIRequestError(f"Request failed: {str(e)}") -def retrieve_variant_logs(variant_id: str, api_key: Optional[str], host: str, version: str = "cloud"): +def retrieve_variant_logs( + variant_id: str, api_key: Optional[str], host: str, version: str = "cloud" +): """Retrieve variant logs from the server. Args: diff --git a/agenta-web/src/components/Playground/ViewNavigation.tsx b/agenta-web/src/components/Playground/ViewNavigation.tsx index 3c5f16703f..8c86231ef0 100644 --- a/agenta-web/src/components/Playground/ViewNavigation.tsx +++ b/agenta-web/src/components/Playground/ViewNavigation.tsx @@ -113,7 +113,7 @@ const ViewNavigation: React.FC = ({ if (isError) { let variantDesignator = variant.templateVariantName let appName = currentApp?.app_name || "" - let imageName = `agentaai/${(appName).toLowerCase()}_` + let imageName = `agentaai/${appName.toLowerCase()}_` if (!variantDesignator || variantDesignator === "") { variantDesignator = variant.variantName @@ -175,16 +175,18 @@ const ViewNavigation: React.FC = ({ accessible.
  • - Check if the Docker container for the variant {variantDesignator} is active by running the following command in your terminal: + Check if the Docker container for the variant {variantDesignator} is + active by running the following command in your terminal:
    docker logs {containerName} --tail 50 -f
    - Running the above command will enable you to continuously stream the container logs in real-time as they are generated. + Running the above command will enable you to continuously stream the + container logs in real-time as they are generated.
  • {" "} - In case the docker container is not running, please check the Docker logs to understand the issue. - Most of the time, it is due to missing requirements. - Also, please attempt restarting it (using cli or docker + In case the docker container is not running, please check the Docker + logs to understand the issue. Most of the time, it is due to missing + requirements. Also, please attempt restarting it (using cli or docker desktop).