You can configure a Spark Shell job to run interactive Spark scripts in your EMR cluster.
Prerequisites
Ensure you have created a project. For more information, see project management.Procedure
-
Go to the Projects page in Data Platform.
-
Log in to the E-MapReduce console with your Alibaba Cloud account.
-
In the top navigation bar, select the region and resource group.
-
Click the Data Development tab.
-
-
In the row of the project you want to edit, click Edit Job.
- Create a Spark Shell job.
- On the left side of the page, right-click the target folder and select Create Job.
- In the Create Job dialog box, enter a job name and job description, and select Spark Shell from the Job Type drop-down list.
- Click OK.
- Edit the job content.
- In the job content field, enter the Spark Shell script.
This example uses the Monte Carlo method to estimate the value of Pi.
val count = sc.parallelize(1 to 100).filter { _ => val x = math.random val y = math.random x*x + y*y < 1 }.count(); println("Pi is roughly ${4.0 * count / 100}") - Click Save.
- In the job content field, enter the Spark Shell script.