akashtadwai

Local Config

Jul 9th, 2021 (edited)
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.49 KB | None | 0 0
  1. # Handler function name must match the
  2. # last part of <fileName>.<handlerName>
  3. function handler () {
  4.  
  5.   # # Get the data
  6.   #           EVENT_DATA=$1
  7.   #             # export PYTORCH_PRETRAINED_BERT_CACHE=/tmp/
  8.   #             # echo $PYTORCH_PRETRAINED_BERT_CACHE
  9.   #             # Log the event to stderr
  10.   #               echo "$EVENT_DATA" 1>&2;
  11.  
  12.   #                 # Respond to Lambda service by echoing the received data back
  13.   #                   RESPONSE="Echoing request: '$EVENT_DATA'"
  14.   #                   echo $RESPONSE
  15.   #               echo $EVENT_DATA |  jq '.Records[0].s3.object.key' 1>&2;
  16.   #               key=$(echo $EVENT_DATA | jq '.Records[0].body' | sed -e 's/\\"/"/g' -e 's/^"\(.*\)"$/\1/' | jq  -r '.Records[0].s3.object.key')
  17.   #                bucket=$(echo $EVENT_DATA | jq '.Records[0].body' | sed -e 's/\\"/"/g' -e 's/^"\(.*\)"$/\1/' | jq -r '.Records[0].s3.bucket.name')
  18.   #                echo $key 1>&2;
  19.   #               echo $bucket 1>&2;
  20.   #                cd  /tmp
  21.   #                aws s3 cp s3://$bucket/$key /tmp 1>&2;
  22.   #               zip_filename=$(echo $(basename $key))
  23.   #                echo $zip_filename 1>&2;
  24.                
  25.   #               ls -ltr 1>&2;
  26.   #               unzip /tmp/$zip_filename
  27.   #               echo  "Unzipped the files to /tmp" 1>&2;
  28.   #               ls -ltr  1>&2;
  29.   #               dir_name=$(echo "${zip_filename%%.*}")
  30.   #               echo /tmp/$dir_name 1>&2;
  31.            
  32.                 # mkdir -p /tmp/$dir_name/input   1>&2;
  33.                 # mkdir -p /tmp/$dir_name/input/PDF 1>&2;
  34.                 # mkdir -p /tmp/$dir_name/output 1>&2;
  35.   #               echo "created input and output directories"   1>&2;      
  36.  
  37.   #               ls -ltr /tmp/$dir_name 1>&2;
  38.          
  39.     #   cp  /tmp/$dir_name/*.pdf  /tmp/$dir_name/input/PDF 1>&2;
  40.     #         echo "copied to  input directory "   1>&2;       
  41.                
  42.                 # INPUT_DIR=/tmp/$dir_name/input
  43.                 # OUTPUT_DIR=/tmp/$dir_name/output
  44.                 # INPUT_PDFS=/tmp/$dir_name/input/PDF      
  45.                
  46.     echo "getting into the directory"  1>&2;
  47.     cd /usr/local/ps-ml-recruiter/
  48.     export PATH=$PATH:/sbin
  49.     lambdaPath=$LAMBDA_TASK_ROOT;
  50.     libPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/lib;
  51.     binPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/bin;
  52.     dataPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/tesseract/share/tessdata;
  53.     ldconfig
  54.     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lambdaPath:$libPath:$binPath;
  55.     export TESSDATA_PREFIX='/usr/local/ps-ml-recruiter/amazonlinux-2/tesseract/share/tessdata';
  56.    
  57.       export INPUT_DIR=./input;
  58.      export OUTPUT_DIR=./output;
  59.       export INPUT_PDFS=./input/PDF;
  60.  
  61.     chmod +x src/pdf_to_jpg.sh
  62.     echo "calling image converter"  1>&2;
  63.     bash src/pdf_to_jpg.sh 1>&2;
  64.     tree images  1>&2;
  65.     echo "calling python code"  1>&2;
  66.         python3 main.py &
  67.         python3 main_cv.py &
  68.     wait
  69.     # cd /tmp/$dir_name
  70.     cd /usr/local/ps-ml-recruiter/
  71.     tree output/
  72.     # echo "uploading output to s3 "   1>&2;
  73.     # aws s3 cp output/ s3://$bucket/sectioning --recursive    1>&2;
  74.     #  echo "going to remove the message from queue"  1>&2;  
  75.     # receipt=$(echo $EVENT_DATA | jq '.Records[0].receiptHandle')
  76.     # aws sqs delete-message --queue-url https://sqs.us-east-1.amazonaws.com/426631686673/fresh-cv-notification-queue --receipt-handle $receipt
  77.     #  echo "done deleting the message"  1>&2;  
  78. }
Add Comment
Please, Sign In to add comment