---
title: addTag
description: "SparkSession.addTag method in PySpark: Add a tag to be assigned to all the operations started by this thread in this session."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/sparksession/addTag
---

# addTag

Add a tag to be assigned to all the operations started by this thread in this session.

Often, a unit of execution in an application consists of multiple Spark executions. Application programmers can use this method to group all those jobs together and give a group tag. The application can use `SparkSession.interruptTag` to cancel all running executions with this tag. There may be multiple tags present at the same time, so different parts of an application may use different tags to perform cancellation at different levels of granularity.

## Syntax

```
addTag(tag)
```

## Parameters

| Parameter | Type | Description                                                            |
| --------- | ---- | ---------------------------------------------------------------------- |
| `tag`     | str  | The tag to be added. Cannot contain ',' (comma) or be an empty string. |

## Returns

`None`
