Skip to content

Commit

Permalink
[CoreEngine] add on-premise port.
Browse files Browse the repository at this point in the history
  • Loading branch information
fedml-alex committed Jan 31, 2024
1 parent fbf9e85 commit 556a6b2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion devops/dockerfile/device-image/Dockerfile-Local
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ WORKDIR /fedml
ENV MODE=normal FEDML_VERSION=${VERSION} ACCOUNT_ID=0 SERVER_DEVICE_ID=0 \
FEDML_PACKAGE_NAME=package FEDML_PACKAGE_URL=s3_url \
FEDML_RUNNER_CMD=3dsad \
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_HOST=host.docker.internal
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_HOST=host.docker.internal \
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_PORT=80

CMD bash ./start-redis.sh; python3 ./fedml-pip/fedml/computing/scheduler/master/server_daemon.py -t login -u ${ACCOUNT_ID} -v ${FEDML_VERSION} -r cloud_server -rc ${FEDML_RUNNER_CMD} -id ${SERVER_DEVICE_ID}; bash ./runner.sh
3 changes: 2 additions & 1 deletion devops/dockerfile/server-agent/Dockerfile-Local
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ENV MODE=normal FEDML_VERSION=${VERSION} ACCOUNT_ID=0 SERVER_AGENT_ID=0 \
AWS_IAM_ACCESS_ID=0 \
AWS_IAM_ACCESS_KEY=0 \
AWS_REGION=0 \
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_HOST=host.docker.internal
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_HOST=host.docker.internal \
FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_PORT=80

CMD bash ./start-redis.sh; ./set-aws-credentials.sh ${AWS_IAM_ACCESS_ID} ${AWS_IAM_ACCESS_KEY} ${AWS_REGION};python3 ./fedml-pip/fedml/computing/scheduler/master/server_daemon.py -t login -u ${ACCOUNT_ID} -k ${ACCOUNT_ID} -v ${FEDML_VERSION} -r cloud_agent -id ${SERVER_AGENT_ID};bash ./runner.sh
18 changes: 16 additions & 2 deletions python/fedml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
_global_training_type = None
_global_comm_backend = None

__version__ = "0.8.18.dev8"
__version__ = "0.8.18.dev9"


# This is the deployment environment used for different roles (RD/PM/BD/Public Developers). Potential VALUE: local, dev, test, release
Expand Down Expand Up @@ -458,7 +458,13 @@ def _get_backend_service():
# caller = getframeinfo(stack()[1][0])
# print(f"{caller.filename}:{caller.lineno} - _get_backend_service. version = {version}")
if version == "local":
return f"http://{get_local_on_premise_platform_host()}:18080"
port = int(get_local_on_premise_platform_port())
if port == 80:
return f"http://{get_local_on_premise_platform_host()}"
elif port == 443:
return f"https://{get_local_on_premise_platform_host()}"
else:
return f"http://{get_local_on_premise_platform_host()}:{port}"
elif version == "dev":
return FEDML_BACKEND_SERVICE_URL_DEV
elif version == "test":
Expand Down Expand Up @@ -490,6 +496,14 @@ def get_local_on_premise_platform_host():
return os.environ['FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_HOST']


def set_local_on_premise_platform_port(local_on_premise_platform_port):
os.environ['FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_PORT'] = str(local_on_premise_platform_port)


def get_local_on_premise_platform_port():
return os.environ['FEDML_ENV_LOCAL_ON_PREMISE_PLATFORM_PORT']


def _get_local_s3_like_service_url():
return FEDML_S3_DOMAIN_LOCAL

Expand Down
12 changes: 11 additions & 1 deletion python/fedml/cli/modules/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,19 @@
default="127.0.0.1",
help="The IP address for local on-premise Nexus AI Platform.",
)
def fedml_login(api_key, version, compute_node, server, provider, deploy_worker_num, local_on_premise_platform):
@click.option(
"--local_on_premise_platform_port",
"-lpp",
type=int,
default=80,
help="The port for local on-premise Nexus AI Platform.",
)
def fedml_login(
api_key, version, compute_node, server, provider, deploy_worker_num,
local_on_premise_platform, local_on_premise_platform_port):
fedml.set_env_version(version)
fedml.set_local_on_premise_platform_host(local_on_premise_platform)
fedml.set_local_on_premise_platform_port(local_on_premise_platform_port)

api_key = api_key[0] if len(api_key) > 0 else None
try:
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def finalize_options(self):

setup(
name="fedml",
version="0.8.18.dev8",
version="0.8.18.dev9",
author="FedML Team",
author_email="ch@fedml.ai",
description="A research and production integrated edge-cloud library for "
Expand Down

0 comments on commit 556a6b2

Please sign in to comment.