# Working with workspaces on AnVIL Azure

    library(AnVILAz)

# Workspaces

Workspaces on AnVIL Azure are a way to organize and manage data and analysis resources. Workspaces are created by users and can be shared with other users.

## Listing workspaces

The `avworkspaces()` function lists the workspaces available to the current user.

    avworkspaces()

## Caveats

Workspaces on AnVIL are managed resources and do not provide a lot of freedom to work across workspaces. The `AnVILAz` package mainly provides functions to work with workspaces within the same namespace.

There may be some workspaces that still operate using the Google Cloud Platform (GCP) and these workspaces are not accessible through the `AnVILAz` package though they may be listed in `avworkspaces()`. We refer users to `AnVILGCP` for working with GCP-based workspaces.

## Current workspace

The `avworkspace()` function returns the name of the current workspace provided that it is set.

    avworkspace()

## Setting the current workspace

The `avworkspace()` function can be used to set the current workspace.

    avworkspace("my-namespace/my-workspace")
    avworkspace()

Typically this is not necessary as these values can be gathered from the AnVIL Azure environment.

## Namespace and workspace

The `avworkspace_namespace()` and `avworkspace_name()` functions return the namespace and name of the current workspace.

    avworkspace_namespace()

    avworkspace_name()

# Cloning a workspace

The `avworkspace_clone()` function clones a workspace.

    avworkspace_clone(
        namespace = "my-namespace",
        name = "my-workspace",
        to_namespace = "my-new-namespace",
        to_name = "my-workspace-clone"
    )
    avworkspaces()

Note that currently, the `createdBy` field is not populated with the user’s information. This is a known issue and will be addressed in a future release.

# Deleting a workspace

To delete a workspace, it is recommended to use the AnVIL Azure interface.

# Notebooks

Notebooks are a way to interact with the data and analysis resources in a workspace. The `avnotebooks()` function lists the notebooks available in the current workspace.

    avnotebooks()

Typically, notebooks are kept on the Azure Blob Storage (ABS) Container in a `analyses/` folder.

## Localize / Delocalize

The `avnotebooks_localize()` function downloads a notebook to the local filesystem. By default, it will download all the notebooks located in the `analyses/` folder to a matching `analyses` local folder. Note that this is a convenience function for `avcopy` file transfer operations.

    avnotebooks_localize(destination = "./analyses")

On the other hand, the `avnotebooks_delocalize()` function uploads all the notebooks within the given directory (by default, the current directory) to the Azure Blob Storage Container. It places them in the `analyses/` folder on the ABS Container.

    avnotebooks_delocalize(source = "./")

# Workflows

## Listing current workflow runs

The `avworkflows_jobs()` function reports the status of the current workflows within the workspace.

    avworkflows_jobs()

It provides a tibble with workflow information such as the `run_set_id`, `run_set_name`, `submission_timestamp`, `error_count`, `run_count`, `state`, etc.

## Listing workflow inputs

The `avworkflows_jobs_inputs()` function lists the inputs for a given workflow. It returns a list of `tibbles` with the inputs for each workflow within the current workspace.

    avworkflows_jobs_inputs()

# sessionInfo

    sessionInfo()
    ## R version 4.6.0 (2026-04-24)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.4 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: Etc/UTC
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] stats     graphics  grDevices utils     datasets  methods   base
    ##
    ## other attached packages:
    ## [1] AnVILAz_1.6.0    BiocStyle_2.38.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] vctrs_0.7.3          httr_1.4.8           cli_3.6.6
    ##  [4] knitr_1.51           rlang_1.2.0          xfun_0.57
    ##  [7] jsonlite_2.0.0       glue_1.8.1           rjsoncons_1.3.2
    ## [10] buildtools_1.0.0     htmltools_0.5.9      maketools_1.3.2
    ## [13] BiocBaseUtils_1.12.0 sys_3.4.3            sass_0.4.10
    ## [16] rappdirs_0.3.4       rmarkdown_2.31       tibble_3.3.1
    ## [19] evaluate_1.0.5       jquerylib_0.1.4      fastmap_1.2.0
    ## [22] yaml_2.3.12          lifecycle_1.0.5      httr2_1.2.2
    ## [25] BiocManager_1.30.27  compiler_4.6.0       pkgconfig_2.0.3
    ## [28] digest_0.6.39        R6_2.6.1             pillar_1.11.1
    ## [31] magrittr_2.0.5       bslib_0.10.0         tools_4.6.0
    ## [34] AnVILBase_1.4.0      cachem_1.1.0