Skip to content

Commit a480489

Browse files
author
Emerson Antony
committed
Updated latest fixes
1 parent 830d9c4 commit a480489

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Here is a summary of the main steps in the script:
4242
1. The lambda_handler function is the entry point for the Lambda function. It receives an event object and a context object as parameters.
4343
2. The s3_bucket_script and input_script variables are used to specify the Amazon S3 bucket and object key where the Spark script is located.
4444
3. The boto3 module is used to download the Spark script from Amazon S3 to a temporary file on the Lambda function's file system.
45-
4. The os.environ dictionary is used to set the PYSPARK_SUBMIT_ARGS environment variable, which is required by the Spark application to run.
45+
4. The os.environ dictionary is used to store any arguments passed via the lambda event.
4646
5. The subprocess.run method is used to execute the spark-submit command, passing in the path to the temporary file where the Spark script was downloaded.The event payload recieved by the lambda is passed onto the spark application via the event arguement.
4747
Overall, this script enables you to execute a Spark script in AWS Lambda by downloading it from an S3 bucket and running it using the spark-submit command. The script can be configured by setting environment variables, such as the PYSPARK_SUBMIT_ARGS variable, to control the behavior of the Spark application. </p>
4848

cloudformation/sam-imagebuilder.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ Resources:
133133
- echo Downloading requires source files from git
134134
- git clone https://github.com/aws-samples/spark-on-aws-lambda.git
135135
- cd spark-on-aws-lambda
136-
- git checkout dockerfilefixes
137136
- echo Build started on `date`
138137
- echo Building the Docker image...
139138
- docker build --build-arg FRAMEWORK=$FRAMEWORK -t $IMAGE_REPO_NAME:latest .

sparkLambdaHandler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ def spark_submit(s3_bucket_script: str,input_script: str, event: dict)-> None:
3434
Submits a local Spark script using spark-submit.
3535
"""
3636
# Set the environment variables for the Spark application
37-
pyspark_submit_args = event.get('PYSPARK_SUBMIT_ARGS', '')
38-
# Source input and output if available in event
39-
input_path = event.get('INPUT_PATH','')
40-
output_path = event.get('OUTPUT_PATH', '')
37+
# pyspark_submit_args = event.get('PYSPARK_SUBMIT_ARGS', '')
38+
# # Source input and output if available in event
39+
# input_path = event.get('INPUT_PATH','')
40+
# output_path = event.get('OUTPUT_PATH', '')
41+
4142
for key,value in event.items():
4243
os.environ[key] = value
4344
# Run the spark-submit command on the local copy of teh script

0 commit comments

Comments
 (0)