inferless-cli
Advanced tools
| # __init__.py | ||
| __version__ = "2.0.17" | ||
| __version__ = "2.0.18" |
@@ -231,3 +231,2 @@ import os | ||
| runtime_name, | ||
| region, | ||
| file_name, | ||
@@ -1016,7 +1015,4 @@ runtime, | ||
| # _, _, _, workspace_id, _ = decrypt_tokens() | ||
| # regions = get_workspace_regions({"workspace_id": workspace_id}) | ||
| # Define default regions | ||
| default_regions_non_beta = {"T4": "region-1", "A100": "region-2", "A10": "region-1"} | ||
| default_regions_beta = {"T4": "region-3", "A100": "region-6", "A10": "region-3"} | ||
| # Fetch all machines | ||
| machines = get_machines() | ||
@@ -1026,24 +1022,63 @@ # Determine machine type and deploy type | ||
| # Fetch all machines | ||
| machines = get_machines() | ||
| # Create empty region mappings that will be populated dynamically | ||
| default_regions_non_beta = {} | ||
| default_regions_beta = {} | ||
| # Filter machines matching the machine_type and deploy_type | ||
| # Create mapping of GPU types to their default regions | ||
| # We'll create separate mappings for beta (SERVERLESS) and non-beta (CONTAINER) | ||
| for m in machines: | ||
| gpu_name = m["name"] | ||
| region_name = m["region_name"] | ||
| # For non-beta (CONTAINER) regions | ||
| if m["deploy_type"] == "CONTAINER" and gpu_name not in default_regions_non_beta: | ||
| default_regions_non_beta[gpu_name] = region_name | ||
| # For beta (SERVERLESS) regions | ||
| if m["deploy_type"] == "SERVERLESS" and gpu_name not in default_regions_beta: | ||
| default_regions_beta[gpu_name] = region_name | ||
| # Get deploy type based on beta flag | ||
| deploy_type = "SERVERLESS" if beta else "CONTAINER" | ||
| # Filter machines matching the machine_type, machine_type_actual, and deploy_type | ||
| filtered_machines = [ | ||
| m | ||
| for m in machines | ||
| if m["name"] == machine_type and m["machine_type"] == machine_type_actual | ||
| if m["name"] == machine_type | ||
| and m["machine_type"] == machine_type_actual | ||
| and m["deploy_type"] == deploy_type | ||
| ] | ||
| if not filtered_machines: | ||
| raise InferlessCLIError( | ||
| f"No machines found for type '{machine_type}' with type '{machine_type_actual}'." | ||
| ) | ||
| # Try without deploy_type filter if no machines found | ||
| filtered_machines = [ | ||
| m | ||
| for m in machines | ||
| if m["name"] == machine_type and m["machine_type"] == machine_type_actual | ||
| ] | ||
| if not filtered_machines: | ||
| raise InferlessCLIError( | ||
| f"No machines found for type '{machine_type}' with type '{machine_type_actual}'." | ||
| ) | ||
| # If region is None, return default region | ||
| if region is None: | ||
| default_region = ( | ||
| default_regions_beta[machine_type] | ||
| if beta | ||
| else default_regions_non_beta[machine_type] | ||
| ) | ||
| default_region = None | ||
| # First try to get from our dynamic mappings | ||
| if beta and machine_type in default_regions_beta: | ||
| default_region = default_regions_beta[machine_type] | ||
| elif not beta and machine_type in default_regions_non_beta: | ||
| default_region = default_regions_non_beta[machine_type] | ||
| # If not found in mappings, use the first filtered machine's region | ||
| if not default_region and filtered_machines: | ||
| default_region = filtered_machines[0]["region_name"] | ||
| if not default_region: | ||
| raise InferlessCLIError( | ||
| f"No default region found for machine type '{machine_type}'." | ||
| ) | ||
| return default_region, beta | ||
@@ -1060,3 +1095,3 @@ | ||
| # Additional beta logic | ||
| if beta: | ||
| if beta and machine_type in default_regions_beta: | ||
| expected_region = default_regions_beta[machine_type] | ||
@@ -1063,0 +1098,0 @@ if region != expected_region: |
@@ -191,3 +191,2 @@ from typing import List | ||
| break | ||
| ( | ||
@@ -197,3 +196,2 @@ uid, | ||
| payload, | ||
| region, | ||
| name, | ||
@@ -208,3 +206,2 @@ runtime_id, | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -211,0 +208,0 @@ path, |
@@ -8,3 +8,2 @@ import sys | ||
| from inferless_cli.commands.init.helpers import ( | ||
| get_region_id, | ||
| get_region_region_id, | ||
@@ -78,7 +77,3 @@ ) | ||
| ) | ||
| table.add_column( | ||
| "Region", | ||
| ) | ||
| table.add_column("Status") | ||
| regions = get_regions_values() | ||
| for runtime in runtimes: | ||
@@ -88,3 +83,2 @@ table.add_row( | ||
| runtime["name"], | ||
| get_regions(runtime["region"], regions), | ||
| runtime["status"], | ||
@@ -140,3 +134,3 @@ ) | ||
| try: | ||
| uid, file_name, payload, region, name, runtime_id, workspace_id, path = ( | ||
| uid, file_name, payload, name, runtime_id, workspace_id, path = ( | ||
| validate_runtime_command_inputs(path, False, None, name) | ||
@@ -148,3 +142,2 @@ ) | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -192,3 +185,3 @@ path, | ||
| try: | ||
| uid, file_name, payload, region, name, runtime_id, workspace_id, path = ( | ||
| uid, file_name, payload, name, runtime_id, workspace_id, path = ( | ||
| validate_runtime_command_inputs(path, True, runtime_name, "") | ||
@@ -200,7 +193,6 @@ ) | ||
| name, | ||
| region, | ||
| file_name, | ||
| path, | ||
| workspace_id, | ||
| patch, | ||
| True, | ||
| runtime_id, | ||
@@ -234,3 +226,3 @@ ) | ||
| log_exception(error) | ||
| rich.print("\n[red]Something went wrong[/red]") | ||
| rich.print(f"\n[red]Something went wrong: [/red] {error}") | ||
| raise typer.Abort(1) | ||
@@ -270,3 +262,2 @@ | ||
| ) | ||
| region = get_regions_prompt() | ||
@@ -277,3 +268,3 @@ if runtime_id: | ||
| runtime = get_runtime_details(runtimes, runtime_id) | ||
| region = runtime["region"] | ||
| name = runtime["name"] | ||
@@ -287,3 +278,3 @@ | ||
| } | ||
| return uid, file_name, payload, region, name, runtime_id, workspace_id, path | ||
| return uid, file_name, payload, name, runtime_id, workspace_id, path | ||
@@ -303,3 +294,2 @@ | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -324,3 +314,2 @@ path, | ||
| # ) | ||
| regions = get_regions_values() | ||
@@ -331,3 +320,2 @@ res = create_presigned_url( | ||
| name, | ||
| get_region_id(region, regions), | ||
| file_name.replace(" ", ""), | ||
@@ -499,18 +487,18 @@ path, | ||
| def get_regions_prompt(): | ||
| _, _, _, workspace_id, _ = decrypt_tokens() | ||
| with Progress( | ||
| SpinnerColumn(), TextColumn(SPINNER_DESCRIPTION), transient=True | ||
| ) as progress: | ||
| task_id = progress.add_task(description="processing...", total=None) | ||
| regions = get_workspace_regions({"workspace_id": workspace_id}) | ||
| progress.remove_task(task_id) | ||
| if regions: | ||
| regions_names = [region["region_name"] for region in regions] | ||
| region = typer.prompt( | ||
| f"Select Region ({', '.join(regions_names)})", | ||
| ) | ||
| # def get_regions_prompt(): | ||
| # _, _, _, workspace_id, _ = decrypt_tokens() | ||
| # with Progress( | ||
| # SpinnerColumn(), TextColumn(SPINNER_DESCRIPTION), transient=True | ||
| # ) as progress: | ||
| # task_id = progress.add_task(description="processing...", total=None) | ||
| # regions = get_workspace_regions({"workspace_id": workspace_id}) | ||
| # progress.remove_task(task_id) | ||
| # if regions: | ||
| # regions_names = [region["region_name"] for region in regions] | ||
| # region = typer.prompt( | ||
| # f"Select Region ({', '.join(regions_names)})", | ||
| # ) | ||
| return region | ||
| # return region | ||
| raise InferlessCLIError("Regions not found") | ||
| # raise InferlessCLIError("Regions not found") |
@@ -84,31 +84,2 @@ from inferless_cli.utils.credentials import select_url | ||
| UPLOAD_METHODS = ["GIT", "LOCAL"] | ||
| REGION_TYPES = ["region-1", "region-2"] | ||
| REGION_MAP = { | ||
| "AZURE": "region-2", | ||
| "AWS": "region-1", | ||
| "SERVERLESS_AWS": "region-3", | ||
| "SERVERLESS_GCP": "region-4", | ||
| "AZURE-USEAST": "region-5", | ||
| } | ||
| REGION_MAP_KEYS = { | ||
| "region-2": "AZURE", | ||
| "region-1": "AWS", | ||
| "region-3": "SERVERLESS_AWS", | ||
| "region-4": "SERVERLESS_GCP", | ||
| "region-5": "AZURE-USEAST", | ||
| } | ||
| REGION_MAP_VOLUME = { | ||
| "AZURE": "region-2", | ||
| "AWS": "region-1", | ||
| "SERVERLESS_AWS": "region-3", | ||
| "SERVERLESS_GCP": "region-4", | ||
| "AZURE-USEAST": "region-5", | ||
| } | ||
| REGION_MAP_VOLUME_KEYS = { | ||
| "region-2": "AZURE", | ||
| "region-1": "AWS", | ||
| "region-3": "SERVERLESS_AWS", | ||
| "region-4": "SERVERLESS_GCP", | ||
| "region-5": "AZURE-USEAST", | ||
| } | ||
| MACHINE_TYPE_SERVERS = ["SHARED", "DEDICATED"] | ||
@@ -115,0 +86,0 @@ MACHINE_TYPE_SERVERS_DEF = [ |
@@ -221,3 +221,2 @@ import os | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -238,3 +237,2 @@ path, | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -392,3 +390,2 @@ path, | ||
| name, | ||
| region, | ||
| file_name, | ||
@@ -419,7 +416,5 @@ path, | ||
| "template_url": f"{uuid}/{file_name}", | ||
| "region": region, | ||
| } | ||
| if is_patch and runtime_id: | ||
| payload["template_id"] = runtime_id | ||
| del payload["region"] | ||
@@ -426,0 +421,0 @@ return save_runtime(payload) |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: inferless-cli | ||
| Version: 2.0.17 | ||
| Version: 2.0.18 | ||
| Summary: Inferless - Deploy Machine Learning Models in Minutes. | ||
@@ -5,0 +5,0 @@ Author: Naveen |
+1
-1
| [tool.poetry] | ||
| name = "inferless-cli" | ||
| version = "2.0.17" | ||
| version = "2.0.18" | ||
| description = "Inferless - Deploy Machine Learning Models in Minutes." | ||
@@ -5,0 +5,0 @@ authors = ["Naveen <naveen@inferless.com>"] |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
394153
0.04%8985
-0.24%