Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs-ref-services/preview/synapse-spark-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/@azure/s

## Examples

### Get Spark Jobs information

```ts
import { SparkClient } from "@azure/synapse-spark";
import { DefaultAzureCredential } from "@azure/identity";
Expand All @@ -50,6 +52,36 @@ export async function main(): Promise<void> {
}
```

### Submit a Spark job

```ts
import { DefaultAzureCredential } from "@azure/identity";
import { SparkClient, SparkBatchJobOptions } from "@azure/synapse-spark";

export async function main(): Promise<void> {
const credential = new DefaultAzureCredential();
const endpoint = "https://mysynapse.dev.azuresynapse.net";
const poolName = "mysparkpool";
const pysparkFile = "abfss://<filesystem>@<storage-account>.dfs.core.windows.net/<pyspark-script-path>";

let client = new SparkClient(credential, endpoint, poolName);

const sparkJobOptions: SparkBatchJobOptions = {
name: 'MySparkJob',
file: pysparkFile,
driverMemory: "1g",
driverCores: 1,
executorMemory: "4g",
executorCores: 2,
executorCount: 2,
arguments: [],
configuration: {}
};

await client.sparkBatch.createSparkBatchJob(sparkJobOptions);
}
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
Expand Down