cowbird.handlers.impl.filesystem ================================ .. py:module:: cowbird.handlers.impl.filesystem Attributes ---------- .. autoapisummary:: cowbird.handlers.impl.filesystem.LOGGER cowbird.handlers.impl.filesystem.DEFAULT_NOTEBOOKS_DIR_NAME cowbird.handlers.impl.filesystem.DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH cowbird.handlers.impl.filesystem.DEFAULT_WPS_OUTPUTS_RES_NAME cowbird.handlers.impl.filesystem.DEFAULT_SECURE_DATA_PROXY_NAME cowbird.handlers.impl.filesystem.DEFAULT_USER_WPS_OUTPUTS_DIR_NAME Classes ------- .. autoapisummary:: cowbird.handlers.impl.filesystem.FileSystem Module Contents --------------- .. py:data:: LOGGER .. py:data:: DEFAULT_NOTEBOOKS_DIR_NAME :value: 'notebooks' .. py:data:: DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH :value: 'public/wps_outputs' .. py:data:: DEFAULT_WPS_OUTPUTS_RES_NAME :value: 'wps_outputs' .. py:data:: DEFAULT_SECURE_DATA_PROXY_NAME :value: 'secure-data-proxy' .. py:data:: DEFAULT_USER_WPS_OUTPUTS_DIR_NAME :value: 'wps_outputs' .. py:class:: 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) Bases: :py:obj:`cowbird.handlers.handler.Handler`, :py:obj:`cowbird.monitoring.fsmonitor.FSMonitor` Keep the proper directory structure in sync with the platform. Create the file system instance. :param settings: Cowbird settings for convenience :param name: Handler name :param jupyterhub_user_data_dir: Path to the JupyterHub user data directory, which will be symlinked to the working directory :param wps_outputs_dir: Path to the wps outputs directory :param secure_data_proxy_name: Name of the secure-data-proxy service found on Magpie :param wps_outputs_res_name: Name of the WPS outputs resource found on Magpie under the secure-data-proxy service :param notebooks_dir_name: Name of the symlink directory found in the user workspace and which directs to the user's notebook directory :param public_workspace_wps_outputs_subpath: Subpath to the directory containing hardlinks to the public WPS outputs data :param 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 .. py:attribute:: required_params .. py:attribute:: jupyterhub_user_data_dir .. py:attribute:: secure_data_proxy_name :value: 'secure-data-proxy' .. py:attribute:: wps_outputs_res_name :value: 'wps_outputs' .. py:attribute:: wps_outputs_dir :value: b'.' .. py:attribute:: notebooks_dir_name :value: 'notebooks' .. py:attribute:: public_workspace_wps_outputs_subpath :value: 'public/wps_outputs' .. py:attribute:: user_wps_outputs_dir_name :value: 'wps_outputs' .. py:attribute:: wps_outputs_user_data_regex .. py:method:: start_wps_outputs_monitoring(monitoring: cowbird.monitoring.monitoring.Monitoring) -> None .. py:method:: get_user_workspace_dir(user_name: str) -> str .. py:method:: get_user_workspace_wps_outputs_dir(user_name: str) -> str .. py:method:: get_public_workspace_wps_outputs_dir() -> str .. py:method:: _get_jupyterhub_user_data_dir(user_name: str) -> str .. py:method:: _create_symlink_dir(src: str, dst: str) -> None :staticmethod: .. py:method:: user_created(user_name: str) -> None .. py:method:: user_deleted(user_name: str) -> None .. py:method:: get_instance() -> FileSystem :staticmethod: Return the FileSystem singleton instance from the class name used to retrieve the FSMonitor from the DB. .. py:method:: _get_public_hardlink(src_path: str) -> str .. py:method:: get_user_hardlink(src_path: str, bird_name: str, user_name: str, subpath: str) -> str .. py:method:: _get_secure_data_proxy_file_perms(src_path: str, user_name: str) -> Tuple[bool, bool] 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. .. py:method:: update_secure_data_proxy_path_perms(src_path: str, user_name: str) -> bool 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. .. py:method:: create_hardlink_path(src_path: str, hardlink_path: str, access_allowed: bool) -> None :staticmethod: Creates a hardlink path from a source file, if the user has access rights. .. py:method:: _create_wps_outputs_hardlink(src_path: str, overwrite: bool = False, process_user_files: bool = True, process_public_files: bool = True) -> None .. py:method:: on_created(path: str) -> None Call when a new path is found. :param path: Absolute path of a new file/directory .. py:method:: on_modified(path: str) -> None Called when a path is updated. :param path: Absolute path of a new file/directory .. py:method:: _delete_wps_outputs_hardlink(src_path: str, process_user_paths: bool = True, process_public_paths: bool = True) -> bool Deletes the hardlink path that corresponds to the input source path. Returns a bool to indicate if a hardlink path was deleted or not. .. py:method:: on_deleted(path: str) -> None Called when a path is deleted. :param path: Absolute path of a new file/directory .. py:method:: _check_if_res_from_secure_data_proxy(res_tree: List[cowbird.typedefs.JSON]) -> bool Checks if the resource is part of a `secure-data-proxy` service of type API. .. py:method:: _update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) -> None .. py:method:: permission_created(permission: cowbird.permissions_synchronizer.Permission) -> None .. py:method:: permission_deleted(permission: cowbird.permissions_synchronizer.Permission) -> None .. py:method:: resync() -> None Resync operation, regenerating required links (user_workspace, wps_outputs, ...)