cowbird.handlers.impl.filesystem

Attributes

LOGGER

DEFAULT_NOTEBOOKS_DIR_NAME

DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH

DEFAULT_WPS_OUTPUTS_RES_NAME

DEFAULT_SECURE_DATA_PROXY_NAME

DEFAULT_USER_WPS_OUTPUTS_DIR_NAME

Classes

FileSystem

Keep the proper directory structure in sync with the platform.

Module Contents

cowbird.handlers.impl.filesystem.LOGGER[source]
cowbird.handlers.impl.filesystem.DEFAULT_NOTEBOOKS_DIR_NAME = 'notebooks'[source]
cowbird.handlers.impl.filesystem.DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH = 'public/wps_outputs'[source]
cowbird.handlers.impl.filesystem.DEFAULT_WPS_OUTPUTS_RES_NAME = 'wps_outputs'[source]
cowbird.handlers.impl.filesystem.DEFAULT_SECURE_DATA_PROXY_NAME = 'secure-data-proxy'[source]
cowbird.handlers.impl.filesystem.DEFAULT_USER_WPS_OUTPUTS_DIR_NAME = 'wps_outputs'[source]
class cowbird.handlers.impl.filesystem.FileSystem(settings: cowbird.typedefs.SettingsType, name: str, jupyterhub_user_data_dir: str, wps_outputs_dir: str, secure_data_proxy_name: str = DEFAULT_SECURE_DATA_PROXY_NAME, wps_outputs_res_name: str = DEFAULT_WPS_OUTPUTS_RES_NAME, notebooks_dir_name: str = DEFAULT_NOTEBOOKS_DIR_NAME, public_workspace_wps_outputs_subpath: str = DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH, user_wps_outputs_dir_name: str = DEFAULT_USER_WPS_OUTPUTS_DIR_NAME, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler, cowbird.monitoring.fsmonitor.FSMonitor

Keep the proper directory structure in sync with the platform.

Create the file system instance.

Parameters:
  • settings – Cowbird settings for convenience

  • name – Handler name

  • jupyterhub_user_data_dir – Path to the JupyterHub user data directory, which will be symlinked to the working directory

  • wps_outputs_dir – Path to the wps outputs directory

  • secure_data_proxy_name – Name of the secure-data-proxy service found on Magpie

  • wps_outputs_res_name – Name of the WPS outputs resource found on Magpie under the secure-data-proxy service

  • notebooks_dir_name – Name of the symlink directory found in the user workspace and which directs to the user’s notebook directory

  • public_workspace_wps_outputs_subpath – Subpath to the directory containing hardlinks to the public WPS outputs data

  • user_wps_outputs_dir_name – Name of the directory found in the user workspace and which contains the hardlinks to the user WPS outputs data

required_params[source]
jupyterhub_user_data_dir[source]
secure_data_proxy_name[source]
wps_outputs_res_name[source]
wps_outputs_dir[source]
notebooks_dir_name[source]
public_workspace_wps_outputs_subpath[source]
user_wps_outputs_dir_name[source]
wps_outputs_user_data_regex[source]
start_wps_outputs_monitoring(monitoring: cowbird.monitoring.monitoring.Monitoring) None[source]
get_user_workspace_dir(user_name: str) str[source]
get_user_workspace_wps_outputs_dir(user_name: str) str[source]
get_public_workspace_wps_outputs_dir() str[source]
_get_jupyterhub_user_data_dir(user_name: str) str[source]
user_created(user_name: str) None[source]
user_deleted(user_name: str) None[source]
static get_instance() FileSystem[source]

Return the FileSystem singleton instance from the class name used to retrieve the FSMonitor from the DB.

_get_secure_data_proxy_file_perms(src_path: str, user_name: str) Tuple[bool, bool][source]

Finds a route from the secure-data-proxy service that matches the resource path (or one of its parent resource) and gets the user permissions on that route.

update_secure_data_proxy_path_perms(src_path: str, user_name: str) bool[source]

Gets a path’s permissions from the secure-data-proxy service and updates the file system permissions accordingly.

Returns a boolean to indicate if the user should have some type of access to the path or not.

Creates a hardlink path from a source file, if the user has access rights.

on_created(path: str) None[source]

Call when a new path is found.

Parameters:

path – Absolute path of a new file/directory

on_modified(path: str) None[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

Deletes the hardlink path that corresponds to the input source path.

Returns a bool to indicate if a hardlink path was deleted or not.

on_deleted(path: str) None[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

_check_if_res_from_secure_data_proxy(res_tree: List[cowbird.typedefs.JSON]) bool[source]

Checks if the resource is part of a secure-data-proxy service of type API.

_update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) None[source]
permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
resync() None[source]

Resync operation, regenerating required links (user_workspace, wps_outputs, …)