Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
feat: platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
zac-li committed Apr 18, 2023
1 parent 424c9f2 commit 24d4366
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
24 changes: 22 additions & 2 deletions lcserve/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def serve_on_jcloud(
requirements: List[str] = None,
app_id: str = None,
version: str = 'latest',
platform: str = None,
verbose: bool = False,
):
from .backend.playground.utils.helper import get_random_tag
Expand All @@ -45,6 +46,7 @@ async def serve_on_jcloud(
requirements=requirements,
tag=tag,
version=version,
platform=platform,
verbose=verbose,
)
app_id, endpoint = await deploy_app_on_jcloud(
Expand All @@ -68,6 +70,7 @@ async def serve_babyagi_on_jcloud(
requirements: List[str] = None,
app_id: str = None,
version: str = 'latest',
platform: str = None,
verbose: bool = False,
):
await serve_on_jcloud(
Expand All @@ -76,6 +79,7 @@ async def serve_babyagi_on_jcloud(
requirements=requirements,
app_id=app_id,
version=version,
platform=platform,
verbose=verbose,
)

Expand Down Expand Up @@ -137,6 +141,13 @@ def local(module, port):
help='Version of serving gateway to be used.',
show_default=False,
)
@click.option(
'--platform',
type=str,
default=None,
help='Platform of Docker image needed for the deployment is built on.',
show_default=False,
)
@click.option(
'--verbose',
is_flag=True,
Expand All @@ -145,12 +156,13 @@ def local(module, port):
)
@click.help_option('-h', '--help')
@syncify
async def jcloud(module, name, app_id, version, verbose):
async def jcloud(module, name, app_id, version, platform, verbose):
await serve_on_jcloud(
module,
name=name,
app_id=app_id,
version=version,
platform=platform,
verbose=verbose,
)

Expand Down Expand Up @@ -183,6 +195,13 @@ async def jcloud(module, name, app_id, version, verbose):
help='Version of serving gateway to be used.',
show_default=False,
)
@click.option(
'--platform',
type=str,
default=None,
help='Platform of Docker image needed for the deployment is built on.',
show_default=False,
)
@click.option(
'--verbose',
is_flag=True,
Expand All @@ -191,12 +210,13 @@ async def jcloud(module, name, app_id, version, verbose):
)
@click.help_option('-h', '--help')
@syncify
async def babyagi(name, requirements, app_id, version, verbose):
async def babyagi(name, requirements, app_id, version, platform, verbose):
await serve_babyagi_on_jcloud(
name=name,
requirements=requirements,
app_id=app_id,
version=version,
platform=platform,
verbose=verbose,
)

Expand Down
5 changes: 3 additions & 2 deletions lcserve/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def push_app_to_hubble(
tag: str = 'latest',
requirements: Tuple[str] = None,
version: str = 'latest',
platform: str = None,
verbose: Optional[bool] = False,
) -> Tuple[str, bool]:
from hubble.executor.hubio import HubIO
Expand Down Expand Up @@ -262,8 +263,8 @@ def push_app_to_hubble(

args = set_hub_push_parser().parse_args(args_list)

# This is done to make sure the image is still built for linux/amd64 when the machine that initializes the deployment uses arm64 (m chip)
args.platform = "linux/amd64"
if platform:
args.platform = platform

if hubble_exists(name):
args.force_update = name
Expand Down

0 comments on commit 24d4366

Please sign in to comment.