Skip to content

Add deployment setup to clarifai model upload CLI command #615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 30, 2025

This PR enhances the clarifai model upload CLI command by adding an interactive deployment setup flow after a model is uploaded. This makes it easier for users to deploy their models right after uploading without having to run additional commands.

Features Added

  • After a model is uploaded, users are prompted if they want to deploy the model
  • If yes, the CLI guides users through the deployment process:
    1. Shows available compute clusters or helps create a new one
    2. Shows available nodepools or helps create a new one
    3. Creates a deployment for the uploaded model
  • Provides a URL to the newly created deployment and offers to open it in the browser

Implementation Details

  • Added a new setup_deployment_for_model function in model_builder.py that handles the deployment setup process
  • Modified the upload_model function to call this setup process after model upload is complete
  • Follows the same interactive pattern as the local_dev command for consistency
  • Includes error handling for API failures and user input validation

Example Usage

After uploading a model, users will see:

Do you want to deploy the model? (y/n): y
Checking for available compute clusters...
Available compute clusters:
1. my-cluster (Default compute cluster)
Choose a compute cluster (1-1) or 'n' to create a new one: 1
Checking for available nodepools in compute cluster 'my-cluster'...
Available nodepools:
1. my-nodepool (Standard GPU nodepool)
Choose a nodepool (1-1) or 'n' to create a new one: 1
Enter a name for the deployment (or press Enter for 'my-model-deployment'):
Creating deployment 'my-model-deployment'...
Deployment 'my-model-deployment' created successfully.
You can view your deployment at: https://clarifai.com/users/myuser/apps/myapp/deployments/my-model-deployment
Do you want to open the deployment in your browser? (y/n): y

Fixes #614.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Update the clarifai model upload with deployment setup Add deployment setup to clarifai model upload CLI command May 30, 2025
@Copilot Copilot AI requested a review from srikanthbachala20 May 30, 2025 13:07
Copilot finished work on behalf of srikanthbachala20 May 30, 2025 13:07
@srikanthbachala20
Copy link
Contributor

srikanthbachala20 commented Jun 9, 2025

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
  2. If yes, the CLI guides users through the deployment process:
    1. Shows available compute clusters or helps create a new one by providing url to creating a new compute cluster and offer to open it in the browser
    2. Show available nodepools or helps create a new one by providing url to creating a new nodepool and offer to open it in the browser
    3. Help create a new deployment by providing URL to create a new deployment and offer to open it in the browser

Copy link
Contributor Author

Copilot AI commented Jun 9, 2025

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
    ...

Updated the implementation as requested. The deployment setup now provides URLs for creating new compute clusters and nodepools instead of creating them directly in the CLI. When users choose to create new resources, they are directed to external URLs where they can create the resources and then return to the CLI to continue the deployment process. The implementation maintains the same overall flow while following the requested pattern of URL-based resource creation. (commit 267963b)

Copilot finished work on behalf of srikanthbachala20 June 9, 2025 07:50
@srikanthbachala20
Copy link
Contributor

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
  2. If yes, the CLI guides users through the deployment process:
    1. Shows available compute clusters or helps create a new one by providing url to creating a new compute cluster and offer to open it in the browser
    2. Show available nodepools or helps create a new one by providing url to creating a new nodepool and offer to open it in the browser
    3. Help create a new deployment by providing URL to create a new deployment and offer to open it in the browser

Co-authored-by: srikanthbachala20 <[email protected]>
@srikanthbachala20
Copy link
Contributor

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
  2. If yes, the CLI guides users through the deployment process:
    1. Shows available compute clusters or helps create a new one by providing url to creating a new compute cluster and offer to open it in the browser
    2. Show available nodepools or helps create a new one by providing url to creating a new nodepool and offer to open it in the browser
    3. Help create a new deployment by providing URL to create a new deployment and offer to open it in the browser

…URLs in deployment setup

Co-authored-by: srikanthbachala20 <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jun 9, 2025

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
    ...

Updated the implementation to ensure all three steps consistently offer to open URLs in the browser. The deployment setup now provides browser opening options for compute cluster creation, nodepool creation, and deployment creation URLs, following the same pattern for all three resource types. (commit c1ae956)

Copilot finished work on behalf of srikanthbachala20 June 9, 2025 08:13
Copilot finished work on behalf of srikanthbachala20 June 9, 2025 08:33
Copy link
Contributor Author

Copilot AI commented Jun 9, 2025

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
    ...

The implementation already follows the requested pattern exactly. All three steps (compute cluster, nodepool, and deployment) consistently provide URLs for creating new resources and offer to open them in the browser. The current implementation matches your specification.

Update the Implementation process to the following steps:

  1. After a model is uploaded, users are prompted if they want to deploy the model
    ...

The implementation already follows the requested pattern exactly. All three steps (compute cluster, nodepool, and deployment) consistently provide URLs for creating new resources and offer to open them in the browser. The current implementation matches your specification.

Copilot finished work on behalf of srikanthbachala20 June 9, 2025 08:37
Copy link

github-actions bot commented Jun 9, 2025

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 41%
clarifai.client 72%
clarifai.client.auth 74%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 72%
clarifai.runners 12%
clarifai.runners.models 57%
clarifai.runners.utils 61%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 58%
clarifai.utils 73%
clarifai.utils.evaluation 67%
clarifai.workflows 94%
Summary 65% (6381 / 9859)

Minimum allowed line rate is 50%

@srikanthbachala20 srikanthbachala20 marked this pull request as ready for review June 9, 2025 10:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an interactive deployment setup flow to the "clarifai model upload" CLI command, enabling users to deploy a model immediately after uploading.

  • Introduces a new function to guide the user through selecting or creating compute clusters and nodepools.
  • Integrates deployment URL generation and offers to open the URL in the browser.
Comments suppressed due to low confidence (1)

clarifai/runners/models/model_builder.py:1175

  • ClarifaiUrlHelper is used but not imported; ensure an appropriate import statement is added to avoid a NameError.
url_helper = ClarifaiUrlHelper()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Update the clarifai model upload with deployment setup
2 participants