Skip to content

Commit

Permalink
Update serving_creator_func.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSkralivetsky authored Oct 7, 2024
1 parent 3c2704b commit 977224f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions serving_creator_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@ def deploy_serving_functions(context, number_of_servings, number_of_models):
for serving_num in range(number_of_servings):
serving_fn = project.set_function("hub://v2_model_server", f"serving-func{str(serving_num)}", kind="serving", image="mlrun/mlrun")
serving_fn.apply(mlrun.auto_mount())
serving_fn.set_config("spec.readinessTimeoutSeconds", 1200)

# Add the models to the serving function's routing spec
for model_num in range(number_of_models):

# Get a random model from the logged models and add it to the serving
random_model = models[random.randint(0, len(models) -1 )]
# serving_fn.add_model(key=random_model.key, model_path=f"store://models/{project.name}/{random_model.key}:latest")
serving_fn.add_model(key=random_model.key, model_path=random_model.uri)


# (OPTIONAL) Create a tracking policy
# tracking_policy = {'default_batch_intervals':"", "default_batch_image":"", "stream_image":"", "default_controller_image":""}

# Enable model monitoring (If you specified tracking_policy, pass it to 'tracking_policy' param)
# Enable model monitoring
serving_fn.set_tracking()

serving_fn.deploy()

0 comments on commit 977224f

Please sign in to comment.