Read the following document…
- User
Read the following document
Connecting to Tecton via third-party or local Spark notebook If you have the expertise in house to debug Livy-related issues connecting to a Tecton notebook cluster, then you can follow the below instructions:
A. Permissions: Spark must have the appropriate permission to access Tecton data sources. This can be accomplished by either:
Running the local Spark context on an EC2 instance that has an instance profile which has access to the necessary data sources
Manually provide AWS credentials that grant access to the data sources by setting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables
B. Software: The following software must be installed on the machine that will be running the notebook:
Java 8 or Java 11
Python 3.7 or 3.8
pip
C. Initialize cluster secrets and parameters: The following secrets must be created either in AWS Secrets Manager or as environment variables.
As AWS secrets: Please refer to this docs page for how to initialize them in the Secrets Manager.
As environment variables: Please create environment variables (or you can manually set them in your notebook using os.environ[]) API_SERVICE and TECTON_API_KEY. Refer to the docs page above for the values to put in these variables.
D. Install Tecton and Spark:
Run pip install 'tecton[pyspark]'
E. Install the sparkmagic Jupyter/Jupyter Lab extension, which provides additional information when running Spark jobs in a local notebook.
F. Initialize the PySpark session: In your notebook, run the following commands:
Initialize the Spark session
builder = SparkSession.builder
Add necessary jars that are required to interact with AWS.
See this page for a list of potential additional jars depending on your
data sources: https://docs.tecton.ai/latest/setting-up-tecton/04b-connecting-emr.html#additional-jars-and-libraries
builder = build.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:3.2.0,com.amazonaws:aws-java-sdk-bundle:1.11.375")
Set the S3 client implementation:
builder = build.config("spark.hadoop.fs.s3.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem")
G. Run your Tecton commands: Once the Spark session is created, Tecton’s SDK will automatically pick up the session and use it. From this point forward, you’ll be able to run Tecton SDK commands using your local Spark context.
acknowledge if you have finished reading. No summary needed
- Assistant
I have finished reading the document. I am ready for the next command or to provide a summary if needed. Based on your instructions, no summary is required.
- User
Use the above context to generate code which will use the sagemaker PysparkProcessor to write feature processing code using tecton
- Assistant
To write feature processing code using Tecton with the SageMaker PySparkProcessor, first ensure you have the necessary dependencies installed and configurations set up as described in the document. Here's a code example to get started:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.