MCPcopy Create free account
hub / github.com/NVIDIA/nvcf / runInvoke

Function runInvoke

src/clis/nvcf-cli/cmd/function.go:2026–2065  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

2024 defer nvcfClient.Close()
2025
2026 ctx := context.Background()
2027
2028 if config.DeleteDeploymentOnly {
2029 // Delete only the deployment
2030 verb := "Deleting deployment for"
2031 if config.Graceful {
2032 verb = "Gracefully deleting deployment for"
2033 }
2034 logging.Info("%s function %s (version %s)...", verb, config.FunctionID, config.VersionID)
2035
2036 if err := nvcfClient.DeleteDeployment(ctx, config.FunctionID, config.VersionID, config.Graceful); err != nil {
2037 return fmt.Errorf("failed to delete deployment: %w", err)
2038 }
2039
2040 logging.Success("Deployment for function %s (version %s) deleted successfully!", config.FunctionID, config.VersionID)
2041 } else {
2042 // Delete the entire function
2043 logging.Info("Deleting function %s (version %s)...", config.FunctionID, config.VersionID)
2044
2045 if err := nvcfClient.DeleteFunction(ctx, config.FunctionID, config.VersionID); err != nil {
2046 return fmt.Errorf("failed to delete function: %w", err)
2047 }
2048
2049 logging.Success("Function %s (version %s) deleted successfully!", config.FunctionID, config.VersionID)
2050
2051 // Clear function state if we deleted the current function
2052 if err := LoadStateForCurrentCommand(); err == nil {
2053 currentState := GetCurrentState()
2054 if currentState.FunctionID == config.FunctionID && currentState.VersionID == config.VersionID {
2055 sm := GetStateManagerForCurrentCommand()
2056 sm.ClearFunction()
2057 if err := SaveStateForCurrentCommand(); err != nil {
2058 logging.Warning("Failed to clear function from state: %v", err)
2059 } else {
2060 logging.Info("Cleared current function from state")
2061 }
2062 }
2063 }
2064 }
2065
2066 return nil
2067}
2068

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
loadInvokeConfigFunction · 0.85
GetCurrentStateFunction · 0.85
applySavedInvokeContextFunction · 0.85
validateInvokeConfigFunction · 0.85
invokeViaGRPCFunction · 0.85
invokeViaRESTFunction · 0.85
WarningMethod · 0.80
NewClientMethod · 0.80
ErrorfMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected