Skip to content
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

Support cookbook in connectapi: Creating Execution Environments, Viewing Execution Environment Runtimes #313

Open
2 tasks
toph-allen opened this issue Oct 9, 2024 · 0 comments
Assignees

Comments

@toph-allen
Copy link
Collaborator

toph-allen commented Oct 9, 2024

The code below imagines a basic / bare-bones approach, but execution environments are a resource class with CRUD methods, so — thinking about it, that should be our approach.

So, this looks like

Tasks


Viewing Execution Environment Runtimes

library(connectapi)

IMAGE_NAME <- "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic"

client <- connect()

all_images <- get_environments(client)
environments[[IMAGE_NAME]]$runtimes
# A tibble: 3 × 3
   language version path
   <chr>    <chr>   <chr>
 1 Python   3.10.4  /opt/python/3.10.4/bin/python3
 2 Quarto   1.0.35  /opt/quarto/bin/quarto
 3 R        4.1.3   /opt/R/4.1.3/bin/R

Notes

  • The subsetting looks kinda janky. I'm assuming here that environments is a list of environments with more than just runtimes, but if all we care about here is runtimes, I guess I could imagine a few return formats: (1) a data frame with a column for environment name; (2) a list of environments, each a list with multiple fields including runtimes; (3) a list of environments, each an object with multiple fields including runtimes; (4) a list of runtime tibbles. [Update] We should do number (3).

Creating Execution Environments

library(connectapi)

CONTAINER_REGISTRY = "myorg/myrepo"

client = connect()

create_environment(
  title = "Custom Image Classifier",
  description = "My custom image classifier",
  cluster_name = "Kubernetes",
  name = paste0(CONTAINER_REGISTRY, "/image-classifier:jammy"),
  matching = "exact",
  r_version = "4.2.3",
  r_path = "/opt/R/4.2.3/bin/R",
  python_version = "3.9.14",
  python_path = "/opt/python/3.9.14/python"
)

A JSON object representing the environment is returned.

create_execution_environment(title = "Project alpha", description = , ...)

Accept many things, but at the very outset covert to a single type.

It's reasonable that if you know a version, you can guess the path. Like 4.2.3, guess the path?

What if it's a vector of versions?

Could just have just separate parameters for python, quarto, r, tensorflow. list(list(path = "opt/234/r", version = "234"), list(path = "opt/567/r", version = "567")).

@toph-allen toph-allen self-assigned this Oct 9, 2024
@toph-allen toph-allen added the resource objects representing crud resources on Connect label Oct 9, 2024
@toph-allen toph-allen changed the title Implement cookbook recipes in connectapi: Creating Execution Environments, Viewing Execution Environment Runtimes Support cookbook in connectapi: Creating Execution Environments, Viewing Execution Environment Runtimes Oct 22, 2024
@toph-allen toph-allen removed the resource objects representing crud resources on Connect label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant