Skip to content

[MINOR][CORE] Rename scheduler ref for readability#43873

Closed
shrinidhijoshi wants to merge 1 commit intoapache:masterfrom
shrinidhijoshi:renameRef
Closed

[MINOR][CORE] Rename scheduler ref for readability#43873
shrinidhijoshi wants to merge 1 commit intoapache:masterfrom
shrinidhijoshi:renameRef

Conversation

@shrinidhijoshi
Copy link

@shrinidhijoshi shrinidhijoshi commented Nov 17, 2023

What changes were proposed in this pull request?

Renames (standardize) the TaskScheduler reference variables from scheduler/sched etc to taskScheduler

Why are the changes needed?

Multiple classes in core/ ( like CoarseGrainedScheduler, StandaloneScheduler, etc) currently hold reference to TaskScheduler in a variable scheduler/ sched, etc. This is confusing when reading scheduler code. This PR renames these reference variables to taskScheduler to make the code more readable.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Github Actions

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

No

override val rpcEnv: RpcEnv = sc.env.rpcEnv

private[spark] var scheduler: TaskScheduler = null
private[spark] var taskScheduler: TaskScheduler = null
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for making a PR, but I don't think we need this change inside HeartbeatReceiver.

Copy link
Author

Choose a reason for hiding this comment

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

Sure @dongjoon-hyun. I am curious to understand why you suggest it is not needed ?

* Runs a thread pool that deserializes and remotely fetches (if necessary) task results.
*/
private[spark] class TaskResultGetter(sparkEnv: SparkEnv, scheduler: TaskSchedulerImpl)
private[spark] class TaskResultGetter(sparkEnv: SparkEnv, taskScheduler: TaskSchedulerImpl)
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

Copy link
Contributor

@beliefer beliefer Nov 18, 2023

Choose a reason for hiding this comment

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

Personally, the scheduler looks more minimalist here. No one would suspect that it is related to a task.

*/
private[spark]
class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val rpcEnv: RpcEnv)
class CoarseGrainedSchedulerBackend(taskScheduler: TaskSchedulerImpl, val rpcEnv: RpcEnv)
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

*/
private[spark] class StandaloneSchedulerBackend(
scheduler: TaskSchedulerImpl,
taskScheduler: TaskSchedulerImpl,
Copy link
Member

Choose a reason for hiding this comment

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

A wrong indentation. Also, we don't need this change in this class context.


test("task scheduler is set correctly") {
assert(heartbeatReceiver.scheduler === null)
assert(heartbeatReceiver.taskScheduler === null)
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

The following change looks legit from my perspective. WDYT, @shrinidhijoshi ?

private[spark] class TaskSetManager(
- sched: TaskSchedulerImpl,
+ taskScheduler: TaskSchedulerImpl,

* Runs a thread pool that deserializes and remotely fetches (if necessary) task results.
*/
private[spark] class TaskResultGetter(sparkEnv: SparkEnv, scheduler: TaskSchedulerImpl)
private[spark] class TaskResultGetter(sparkEnv: SparkEnv, taskScheduler: TaskSchedulerImpl)
Copy link
Contributor

@beliefer beliefer Nov 18, 2023

Choose a reason for hiding this comment

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

Personally, the scheduler looks more minimalist here. No one would suspect that it is related to a task.

*/
private[spark] class TaskSetManager(
sched: TaskSchedulerImpl,
taskScheduler: TaskSchedulerImpl,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest sched -> scheduler.

@github-actions
Copy link

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Feb 27, 2024
@github-actions github-actions bot closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants