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

Set up unique remote port number as the default #1007

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion beeflow/common/config_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ def filepath_completion_input(*pargs, **kwargs):
return input(*pargs, **kwargs)


def unique_port():
"""Assign unique port for remote user."""
uid = os.getuid()
port = ((uid%(16000-7777))+7777)
return port


# Below is the definition of all bee config options, defaults and requirements.
# This will be used to validate config files on loading them in the BeeConfig
# singleton class above.
Expand Down Expand Up @@ -256,7 +263,7 @@ def filepath_completion_input(*pargs, **kwargs):
default=False, validator=validation.bool_, prompt=False)

VALIDATOR.option('DEFAULT', 'remote_api_port', info='BEE remote REST API port',
default=7777, validator=int, prompt=False)
default=unique_port(), validator=int, prompt=False)

VALIDATOR.option('DEFAULT', 'workload_scheduler', choices=('Slurm', 'LSF', 'Flux', 'Simple'),
default='Slurm', info='backend workload scheduler to interact with ',
Expand Down
1 change: 0 additions & 1 deletion beeflow/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def find_free_port(start_port=1024, end_port=65535, host='127.0.0.1'):

def create_app():
"""Start the web-server for the API with uvicorn."""
# decide what port we're using for the long term. I set it to port 7777 temporarily

port_number = bc.get('DEFAULT', 'remote_api_port')
if is_port_taken(port_number) is True:
Expand Down
4 changes: 2 additions & 2 deletions coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading