Skip to content

Commit

Permalink
Merge pull request #308 from roboflow/dedicated-deployment-add-arg-du…
Browse files Browse the repository at this point in the history
…ration

Add args for dedicated deployment: duration, deletion_on_expiration
  • Loading branch information
PacificDou authored Aug 16, 2024
2 parents 2bb6d29 + 33a3c60 commit 6f1b08a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from roboflow.models import CLIPModel, GazeModel # noqa: F401
from roboflow.util.general import write_line

__version__ = "1.1.39"
__version__ = "1.1.40"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down
4 changes: 3 additions & 1 deletion roboflow/adapters/deploymentapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ class DeploymentApiError(Exception):
pass


def add_deployment(api_key, machine_type, deployment_name, inference_version):
def add_deployment(api_key, machine_type, duration, delete_on_expiration, deployment_name, inference_version):
url = f"{DEDICATED_DEPLOYMENT_URL}/add"
response = requests.post(
url,
json={
"api_key": api_key,
# "security_level": security_level,
"machine_type": machine_type,
"duration": duration,
"delete_on_expiration": delete_on_expiration,
"deployment_name": deployment_name,
"inference_version": inference_version,
},
Expand Down
12 changes: 12 additions & 0 deletions roboflow/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def add_deployment_parser(subparsers):
deployment_add_parser.add_argument(
"-m", dest="machine_type", help="machine type, run `roboflow deployment machine_type` to see available options"
)
deployment_add_parser.add_argument(
"-t",
dest="duration",
help="duration, how long you want to keep the deployment (unit: hour, default: 3)",
type=float,
default=3,
)
deployment_add_parser.add_argument(
"-e", dest="delete_on_expiration", help="delete when expired (default: True)", type=bool, default=True
)
deployment_add_parser.add_argument(
"-n", dest="deployment_name", help="deployment name, must contain 3-10 lowercase characters"
)
Expand Down Expand Up @@ -60,6 +70,8 @@ def add_deployment(args):
api_key,
# args.security_level,
args.machine_type,
args.duration,
args.delete_on_expiration,
args.deployment_name,
args.inference_version,
)
Expand Down

0 comments on commit 6f1b08a

Please sign in to comment.