Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store Container Logs in 'logs/' Directory with Timestamping for Each Agent Type (Fixes #61) #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

minimalProviderAgentMarket
Copy link
Contributor

Pull Request Description

Overview

This pull request addresses issue #61, which outlines the requirement to store logs from container executions in a dedicated logs/ directory. The solution implemented here ensures that logs are saved with filenames that incorporate both the agent type and a timestamp, regardless of the container's exit status.

Changes Made

  1. Log Directory Creation:

    • A check has been added to ensure that the logs/ directory exists. If it does not, the program will create it before attempting to save any logs.
  2. Logging Implementation:

    • The logs are now captured after the container's execution, utilizing the agent type and current timestamp for the filenames to ensure uniqueness and contextual clarity.
    • A helper function was created to generate the appropriate log file path based on the agent type and timestamp.
  3. Error Handling:

    • Robust error handling has been incorporated to manage potential issues during file operations, ensuring that the application behaves reliably during log file creation.
  4. Modifications in containers.py:

    • Necessary imports have been made, including os for directory management and datetime for timestamp generation.
    • Existing functions have been updated to accommodate the new log saving mechanism while preserving their core functionality.

Benefits

  • This enhancement provides better traceability and debugging capabilities by keeping logs even after the containers exit.
  • It improves the overall maintainability and usability of the agent market system by organizing log data systematically.

Conclusion

These updates enhance the minimal provider agent market's logging capabilities and align with our goal of maintaining high-quality, reliable applications.

Fixes #61

Add functionality to store container logs in a timestamped file under 
the logs directory. Fix string access of container status code and 
escape sequence handling in log cleaning. Add required imports for 
datetime and os operations.

Key changes:
- Add _store_container_logs function to save logs to files
- Fix regex pattern for escape sequence cleaning
- Fix container status code dictionary access
- Add logging in finally block to ensure logs are saved
- Add missing agent_type parameter to launch_container function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store logs in folder logs/
1 participant