Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Handler function name must match the
- # last part of <fileName>.<handlerName>
- function handler () {
- # # Get the data
- # EVENT_DATA=$1
- # # export PYTORCH_PRETRAINED_BERT_CACHE=/tmp/
- # # echo $PYTORCH_PRETRAINED_BERT_CACHE
- # # Log the event to stderr
- # echo "$EVENT_DATA" 1>&2;
- # # Respond to Lambda service by echoing the received data back
- # RESPONSE="Echoing request: '$EVENT_DATA'"
- # echo $RESPONSE
- # echo $EVENT_DATA | jq '.Records[0].s3.object.key' 1>&2;
- # key=$(echo $EVENT_DATA | jq '.Records[0].body' | sed -e 's/\\"/"/g' -e 's/^"\(.*\)"$/\1/' | jq -r '.Records[0].s3.object.key')
- # bucket=$(echo $EVENT_DATA | jq '.Records[0].body' | sed -e 's/\\"/"/g' -e 's/^"\(.*\)"$/\1/' | jq -r '.Records[0].s3.bucket.name')
- # echo $key 1>&2;
- # echo $bucket 1>&2;
- # cd /tmp
- # aws s3 cp s3://$bucket/$key /tmp 1>&2;
- # zip_filename=$(echo $(basename $key))
- # echo $zip_filename 1>&2;
- # ls -ltr 1>&2;
- # unzip /tmp/$zip_filename
- # echo "Unzipped the files to /tmp" 1>&2;
- # ls -ltr 1>&2;
- # dir_name=$(echo "${zip_filename%%.*}")
- # echo /tmp/$dir_name 1>&2;
- # mkdir -p /tmp/$dir_name/input 1>&2;
- # mkdir -p /tmp/$dir_name/input/PDF 1>&2;
- # mkdir -p /tmp/$dir_name/output 1>&2;
- # echo "created input and output directories" 1>&2;
- # ls -ltr /tmp/$dir_name 1>&2;
- # cp /tmp/$dir_name/*.pdf /tmp/$dir_name/input/PDF 1>&2;
- # echo "copied to input directory " 1>&2;
- # INPUT_DIR=/tmp/$dir_name/input
- # OUTPUT_DIR=/tmp/$dir_name/output
- # INPUT_PDFS=/tmp/$dir_name/input/PDF
- echo "getting into the directory" 1>&2;
- cd /usr/local/ps-ml-recruiter/
- export PATH=$PATH:/sbin
- lambdaPath=$LAMBDA_TASK_ROOT;
- libPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/lib;
- binPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/bin;
- dataPath=$LAMBDA_TASK_ROOT:/usr/local/ps-ml-recruiter/amazonlinux-2/tesseract/share/tessdata;
- ldconfig
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lambdaPath:$libPath:$binPath;
- export TESSDATA_PREFIX='/usr/local/ps-ml-recruiter/amazonlinux-2/tesseract/share/tessdata';
- export INPUT_DIR=./input;
- export OUTPUT_DIR=./output;
- export INPUT_PDFS=./input/PDF;
- chmod +x src/pdf_to_jpg.sh
- echo "calling image converter" 1>&2;
- bash src/pdf_to_jpg.sh 1>&2;
- tree images 1>&2;
- echo "calling python code" 1>&2;
- python3 main.py &
- python3 main_cv.py &
- wait
- # cd /tmp/$dir_name
- cd /usr/local/ps-ml-recruiter/
- tree output/
- # echo "uploading output to s3 " 1>&2;
- # aws s3 cp output/ s3://$bucket/sectioning --recursive 1>&2;
- # echo "going to remove the message from queue" 1>&2;
- # receipt=$(echo $EVENT_DATA | jq '.Records[0].receiptHandle')
- # aws sqs delete-message --queue-url https://sqs.us-east-1.amazonaws.com/426631686673/fresh-cv-notification-queue --receipt-handle $receipt
- # echo "done deleting the message" 1>&2;
- }
Add Comment
Please, Sign In to add comment