Sandbox

Functions for performing file operations within a sandbox.

A sandbox is a directory on the Cytoscape workstation that is guaranteed writeable and is guaranteed to be isolated from the whole file system. All Python and Cytoscape file operations are carried out relative to the “current sandbox”. Sandboxes primarily address file access issues when running workflows on a remote server (and accessing Cytoscape running on the workstation, either via direct HTTP or via Jupyter-Bridge).

When running a workflow on the Cytoscape workstation (i.e., locally, not remotely), the entire workstation’s file system would be directly accessible to the workflow, and sandboxing isn’t an issue. Essentially, this acknowledges that the user has rightful and safe access to the file system (subject to normal file system permissions).

When running a workflow on a remote server, accessing files local to the workflow’s Python kernel isn’t helpful because they’re on a server that the workstation’s Cytoscape can’t reach. Additionally, it’s problematic to allow the Python kernel to access workstation files anyway because 1) errant notebooks could compromise workstation security, and 2) notebooks can’t easily account for differences in various workstation file systems (e.g., naming files in a Mac is different than in Windows).

Sandboxing solves this by creating a workstation directory that’s guaranteed to exist. The notebook can create and access files within the sandbox (by using the sandbox_* functions in this module), and Cytoscape can do the same. When a workflow runs remotely, py4cytoscape automatically creates a default sandbox for this data flow.

While workflows running on a Cytoscape workstation have access to the entire workstation file system, they can opt to use a sandbox instead. This allows workflows to be developed on a workstation, then moved to a remote server and executed there. (See the sandbox_set() function.)

It’s possible for a workflow to use the default sandbox or (instead) create a custom sandbox for the exclusive use of a workflow or family of workflows.

See Also:

Sandboxing in the Concepts section in the py4cytoscape User Manual.

Sandbox

sandbox_set(sandbox_name[, copy_samples, …])

Set a new default sandbox, creating it if necessary.

sandbox_remove([sandbox_name, base_url])

Delete sandbox contents and remove its directory.

sandbox_get_file_info(file_name[, …])

Get metadata on file in sandbox (or entire sandbox).

sandbox_send_to(source_file[, dest_file, …])

Transfer a file to a sandbox.

sandbox_url_to(source_url, dest_file[, …])

Transfer a cloud-based file to a sandbox.

sandbox_get_from(source_file[, dest_file, …])

Transfer a file from a sandbox.

sandbox_remove_file(file_name[, …])

Remove a file from a sandbox.