Skip to content

Commit

Permalink
add high-assurance placeholder option to endpoint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGlobus committed Nov 11, 2024
1 parent 2de8ef9 commit 2b5c459
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compute_endpoint/globus_compute_endpoint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ def version_command():
default=False,
help="Configure endpoint as multi-user capable",
)
@click.option(
"--high-assurance",
is_flag=True,
default=False,
help="Configure endpoint as high assurance capable",
)
@click.option(
"--display-name",
help="A human readable display name for the endpoint, if desired",
Expand Down Expand Up @@ -366,6 +372,7 @@ def configure_endpoint(
name: str,
endpoint_config: str | None,
multi_user: bool,
high_assurance: bool,
display_name: str | None,
auth_policy: str | None,
auth_policy_project_id: str | None,
Expand All @@ -389,6 +396,11 @@ def configure_endpoint(
if multi_user and not _has_multi_user:
raise ClickException("multi-user endpoints are not supported on this system")

if high_assurance and not auth_policy and not subscription_id:
raise ClickException(
"high-assurance(HA) endpoints require a HA policy or subscription id"
)

if (
auth_policy_project_id is not None
or auth_policy_display_name != _AUTH_POLICY_DEFAULT_NAME
Expand Down Expand Up @@ -433,6 +445,7 @@ def configure_endpoint(
ep_dir,
endpoint_config,
multi_user,
high_assurance,
display_name,
auth_policy,
subscription_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ def __init__(
heartbeat_period: float | int = 30,
environment: str | None = None,
local_compute_services: bool = False,
# high_assurance: bool | None = None,
debug: bool = False,
):
# Misc
self.display_name = display_name
self.debug = debug is True
self.multi_user = multi_user is True

# self.high_assurance = high_assurance is True

# Connection info and tuning
self.amqp_port = amqp_port
self.heartbeat_period = heartbeat_period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

config = UserEndpointConfig(
display_name=None, # If None, defaults to the endpoint name
high_assurance=False,
executors=[
GlobusComputeEngine(
provider=LocalProvider(
Expand Down
10 changes: 10 additions & 0 deletions compute_endpoint/globus_compute_endpoint/endpoint/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def update_config_file(
original_path: pathlib.Path,
target_path: pathlib.Path,
multi_user: bool,
high_assurance: bool,
display_name: str | None,
auth_policy: str | None,
subscription_id: str | None,
Expand All @@ -89,6 +90,9 @@ def update_config_file(
if auth_policy:
config_dict["authentication_policy"] = auth_policy

if high_assurance:
config_dict["high_assurance"] = high_assurance

if multi_user:
config_dict["multi_user"] = multi_user
config_dict.pop("engine", None)
Expand All @@ -109,6 +113,7 @@ def init_endpoint_dir(
endpoint_dir: pathlib.Path,
endpoint_config: pathlib.Path | None = None,
multi_user=False,
high_assurance=False,
display_name: str | None = None,
auth_policy: str | None = None,
subscription_id: str | None = None,
Expand Down Expand Up @@ -143,6 +148,7 @@ def init_endpoint_dir(
endpoint_config,
config_target_path,
multi_user,
high_assurance,
display_name,
auth_policy,
subscription_id,
Expand Down Expand Up @@ -187,6 +193,7 @@ def configure_endpoint(
conf_dir: pathlib.Path,
endpoint_config: str | None,
multi_user: bool = False,
high_assurance: bool = False,
display_name: str | None = None,
auth_policy: str | None = None,
subscription_id: str | None = None,
Expand All @@ -202,6 +209,7 @@ def configure_endpoint(
conf_dir,
templ_conf_path,
multi_user,
high_assurance,
display_name,
auth_policy,
subscription_id,
Expand Down Expand Up @@ -428,6 +436,8 @@ def start_endpoint(
allowed_functions=endpoint_config.allowed_functions,
auth_policy=endpoint_config.authentication_policy,
subscription_id=endpoint_config.subscription_id,
# public=endpoint_config.public,
high_assurance=endpoint_config.high_assurance,
)

except GlobusAPIError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def __init__(
auth_policy=config.authentication_policy,
subscription_id=config.subscription_id,
public=config.public,
high_assurance=config.high_assurance,
)

# Mostly to appease mypy, but also a useful text if it ever
Expand Down
4 changes: 4 additions & 0 deletions compute_sdk/globus_compute_sdk/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def register_endpoint(
auth_policy: UUID_LIKE_T | None = None,
subscription_id: UUID_LIKE_T | None = None,
public: bool | None = None,
high_assurance: bool | None = None,
):
"""Register an endpoint with the Globus Compute service.
Expand All @@ -437,6 +438,8 @@ def register_endpoint(
Endpoint metadata
multi_user : bool | None
Whether the endpoint supports multiple users
high_assurance : bool | None
Whether the endpoint should be high assurance capable
display_name : str | None
The display name of the endpoint
allowed_functions: list[str | UUID] | None
Expand Down Expand Up @@ -467,6 +470,7 @@ def register_endpoint(
auth_policy=auth_policy,
subscription_id=subscription_id,
public=public,
high_assurance=high_assurance,
)
return r.data

Expand Down
3 changes: 3 additions & 0 deletions compute_sdk/globus_compute_sdk/sdk/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def register_endpoint(
subscription_id: t.Optional[UUID_LIKE_T] = None,
public: t.Optional[bool] = None,
additional_fields: t.Optional[t.Dict[str, t.Any]] = None,
high_assurance: t.Optional[bool] = None,
) -> globus_sdk.GlobusHTTPResponse:
data: t.Dict[str, t.Any] = {"endpoint_name": endpoint_name}

Expand All @@ -215,6 +216,8 @@ def register_endpoint(
data["subscription_uuid"] = subscription_id
if public is not None:
data["public"] = public
if high_assurance is not None:
data["high_assurance"] = high_assurance
if additional_fields is not None:
data.update(additional_fields)

Expand Down

0 comments on commit 2b5c459

Please sign in to comment.