seanpedrickcase commited on
Commit
18fb7ec
·
1 Parent(s): 7f2dc0f

Added some debugging statements for entrypoint_router and lambda_entrypoint.py

Browse files
Files changed (2) hide show
  1. entrypoint_router.py +4 -0
  2. lambda_entrypoint.py +9 -1
entrypoint_router.py CHANGED
@@ -5,9 +5,13 @@ if __name__ == "__main__":
5
  run_direct_mode = os.getenv("RUN_DIRECT_MODE", "0")
6
 
7
  if run_direct_mode == "1":
 
 
8
  # Invoke the lambda handler
9
  from lambda_entrypoint import lambda_handler
10
 
 
 
11
  else:
12
  # Gradio App execution
13
  from app import app, max_queue_size, max_file_size # Replace with actual import if needed
 
5
  run_direct_mode = os.getenv("RUN_DIRECT_MODE", "0")
6
 
7
  if run_direct_mode == "1":
8
+
9
+ print("Attempting to import lambda_handler from lambda_entrypoint")
10
  # Invoke the lambda handler
11
  from lambda_entrypoint import lambda_handler
12
 
13
+ print("Imported lambda_handler from lambda_entrypoint")
14
+
15
  else:
16
  # Gradio App execution
17
  from app import app, max_queue_size, max_file_size # Replace with actual import if needed
lambda_entrypoint.py CHANGED
@@ -1,9 +1,13 @@
1
  import boto3
2
  import os
3
  import subprocess
4
- from urllib.parse import unquote_plus
 
5
 
6
  s3_client = boto3.client("s3")
 
 
 
7
  TMP_DIR = "/tmp" # Use absolute path
8
 
9
  def download_file_from_s3(bucket_name, key, download_path):
@@ -17,10 +21,14 @@ def upload_file_to_s3(file_path, bucket_name, key):
17
  print(f"Uploaded {file_path} to {key}")
18
 
19
  def lambda_handler(event, context):
 
20
  # Create necessary directories
21
  os.makedirs(os.path.join(TMP_DIR, "input"), exist_ok=True)
22
  os.makedirs(os.path.join(TMP_DIR, "output"), exist_ok=True)
23
 
 
 
 
24
  # Extract S3 bucket and object key from the Records
25
  for record in event.get("Records", [{}]):
26
  bucket_name = record.get("s3", {}).get("bucket", {}).get("name")
 
1
  import boto3
2
  import os
3
  import subprocess
4
+
5
+ print("In lambda_entrypoint function")
6
 
7
  s3_client = boto3.client("s3")
8
+
9
+ print("s3_client is:", s3_client
10
+ )
11
  TMP_DIR = "/tmp" # Use absolute path
12
 
13
  def download_file_from_s3(bucket_name, key, download_path):
 
21
  print(f"Uploaded {file_path} to {key}")
22
 
23
  def lambda_handler(event, context):
24
+ print("In lambda_handler function")
25
  # Create necessary directories
26
  os.makedirs(os.path.join(TMP_DIR, "input"), exist_ok=True)
27
  os.makedirs(os.path.join(TMP_DIR, "output"), exist_ok=True)
28
 
29
+ print("Got to record loop")
30
+ print("Event records is:", event["Records"])
31
+
32
  # Extract S3 bucket and object key from the Records
33
  for record in event.get("Records", [{}]):
34
  bucket_name = record.get("s3", {}).get("bucket", {}).get("name")