Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLCOMPUTE-949 | Pick spark ui port from a preferred port range #128

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

edingroot
Copy link
Contributor

@edingroot edingroot commented Sep 15, 2023

Pick the Spark UI (API) port from a preferred port range, for scraping metrics from multiple Spark sessions in a single Jupyter server.

Tested in a jupyter server and launched 11 Spark sessions, the port of the 11th session is a random ephemeral port that is currently available on the host/pod.

image

Copy link
Member

@nemacysts nemacysts left a comment

Choose a reason for hiding this comment

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

minor comment re: typo/possible upstreaming, but otherwise seems fine :)

service_configuration_lib/utils.py Outdated Show resolved Hide resolved
@@ -28,3 +35,52 @@ def load_spark_srv_conf(preset_values=None) -> Tuple[Mapping, Mapping, Mapping,
except Exception as e:
log.warning(f'Failed to load {DEFAULT_SPARK_RUN_CONFIG}: {e}')
raise e


def ephemeral_port_reserve_range(preffered_port_start: int, preferred_port_end: int, ip='127.0.0.1') -> int:
Copy link
Member

Choose a reason for hiding this comment

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

it'd be nice to upstream this into the ephemeral_port_reserve repo, but we can wait to see how this works for y'all's usecase first if you'd like :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I added comments explaining the purpose of adding this function and linked to the upstream repository for reference. Let's leave it here for now and test it out first

service_configuration_lib/utils.py Outdated Show resolved Hide resolved
@edingroot edingroot merged commit c9aaf8e into master Sep 20, 2023
1 check passed
@edingroot edingroot deleted the u/chi/pick_from_port_range branch September 20, 2023 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants