Skip to content

[SPARK-45785][CORE] Support spark.deploy.appNumberModulo to rotate app number#43654

Closed
dongjoon-hyun wants to merge 1 commit intoapache:masterfrom
dongjoon-hyun:SPARK-45785
Closed

[SPARK-45785][CORE] Support spark.deploy.appNumberModulo to rotate app number#43654
dongjoon-hyun wants to merge 1 commit intoapache:masterfrom
dongjoon-hyun:SPARK-45785

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Nov 4, 2023

What changes were proposed in this pull request?

This PR aims to support to rotate app number by introducing a new configuration, spark.deploy.appNumberModulo.

Why are the changes needed?

Historically, Apache Spark's App ID has a style, app-yyyyMMddHHmmss-1234. Since the 3rd part, 1234, is a simple sequentially incremented number without any rotation, the generated IDs are like the following.

app-yyyyMMddHHmmss-0000
app-yyyyMMddHHmmss-0001
...
app-yyyyMMddHHmmss-9999
app-yyyyMMddHHmmss-10000

If we support rotation by modulo 10000, it will keep 4 digits.

app-yyyyMMddHHmmss-0000
app-yyyyMMddHHmmss-0001
...
app-yyyyMMddHHmmss-9999
app-yyyyMMddHHmmss-0000

Please note that the second part changes every seconds. In general, modulo by 10000 is enough to generate unique AppIDs.

The following is an example to use modulo 1000. You can tune further by using spark.deploy.appIdPattern configuration.

$ SPARK_MASTER_OPTS="-Dspark.deploy.appNumberModulo=1000 -Dspark.master.rest.enabled=true" sbin/start-master.sh
Screenshot 2023-11-03 at 5 56 17 PM

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs with newly added test case.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the CORE label Nov 4, 2023
@dongjoon-hyun
Copy link
Member Author

Could you review this PR when you have some time, @LuciferYang ?

@dongjoon-hyun
Copy link
Member Author

Could you review this when you have a chance, @yaooqinn ?

Copy link
Member

@yaooqinn yaooqinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dongjoon-hyun
Copy link
Member Author

Thank you so much for review and approval, @yaooqinn !

@dongjoon-hyun
Copy link
Member Author

Merged to master for Apache Spark 4.0.0.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-45785 branch November 4, 2023 05:22
@LuciferYang
Copy link
Contributor

late LGTM

szehon-ho pushed a commit to szehon-ho/spark that referenced this pull request Feb 7, 2024
…app number

### What changes were proposed in this pull request?

This PR aims to support to rotate app number by introducing a new configuration, `spark.deploy.appNumberModulo`.

### Why are the changes needed?

Historically, Apache Spark's App ID has a style, `app-yyyyMMddHHmmss-1234`. Since the 3rd part, `1234`, is a simple sequentially incremented number without any rotation, the generated IDs are like the following.
```
app-yyyyMMddHHmmss-0000
app-yyyyMMddHHmmss-0001
...
app-yyyyMMddHHmmss-9999
app-yyyyMMddHHmmss-10000
```

If we support rotation by modulo 10000, it will keep 4 digits.
```
app-yyyyMMddHHmmss-0000
app-yyyyMMddHHmmss-0001
...
app-yyyyMMddHHmmss-9999
app-yyyyMMddHHmmss-0000
```

Please note that the second part changes every seconds. In general, modulo by 10000 is enough to generate unique AppIDs.

The following is an example to use modulo 1000. You can tune further by using `spark.deploy.appIdPattern` configuration.

```
$ SPARK_MASTER_OPTS="-Dspark.deploy.appNumberModulo=1000 -Dspark.master.rest.enabled=true" sbin/start-master.sh
```

<img width="220" alt="Screenshot 2023-11-03 at 5 56 17 PM" src="https://github.com/apache/spark/assets/9700541/ad1f14c2-49ff-4fa7-b702-923b94d54e29">

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#43654 from dongjoon-hyun/SPARK-45785.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants