Skip to content

Commit

Permalink
fix: packaging
Browse files Browse the repository at this point in the history
adico1 committed Jun 2, 2024
1 parent 9bdab18 commit e9f9bf4
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main_l1.py
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ async def main():
event_handler = EventHandler()
event_handler.register_event(
"batch_processing_completed",
lambda event: asyncio.create_task(retrieve_batches_results_handler(event, event_handler))
lambda event: asyncio.create_task(retrieve_batches_results_handler(event))
)
add_batch_job = init_monitoring(event_handler)

6 changes: 5 additions & 1 deletion src/openai_batch_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from .core import init_monitoring, graceful_shutdown, retrieve_batches_results_handler, retrieve_batches_results
from event_handler import EventHandler
from .event_handler import EventHandler

__all__ = ["init_monitoring", "EventHandler", "graceful_shutdown", "retrieve_batches_results_handler", "retrieve_batches_results"]

from utils.logging import setup_logging

setup_logging()
5 changes: 2 additions & 3 deletions src/openai_batch_sdk/core.py
Original file line number Diff line number Diff line change
@@ -56,9 +56,8 @@ async def retrieve_batches_results(result_file_id):
async def retrieve_batches_results_handler(batch_completed_event):
"""Retrieves results for completed batch jobs."""
batch_id = batch_completed_event['batch_id']
result_file_id = batch_completed_event['result_file_id']
p_logger.info(f"Starting Retrieve Result Process of batch: {batch_id}.")
return retrieve_batches_results(result_file_id)
p_logger.debug(f"Starting Retrieve Result Process of batch: {batch_id}.")
return batch_completed_event['response']

# ==============================================================================
# Batch Job Status Check
6 changes: 3 additions & 3 deletions src/utils/env.py
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
def load_environment():
load_dotenv() # Load environment variables from .env file
return {
'app_log_level': os.getenv('LOG_LEVEL', 'WANRING'),
'libs_log_level': os.getenv('LOG_3RD_PARTY', 'TRACE'),
'low_log_level': os.getenv('LOW_LOG_LEVEL', 'WARNING'),
'app_log_level': os.getenv('LOG_LEVEL', 'ERROR'),
'libs_log_level': os.getenv('LOG_3RD_PARTY', 'ERROR'),
'low_log_level': os.getenv('LOW_LOG_LEVEL', 'ERROR'),
'openai_api_key': os.getenv('OPENAI_API_KEY'),
}

0 comments on commit e9f9bf4

Please sign in to comment.