(self, plugin_name, plugin_config=None, refresh=False)
Initialize the graph from a cached plugin graph.

        Args:
            plugin_name (str): the name of the graph plugin to use.
            plugin_config (dict): optional dictionary to configure the plugin.
            refresh (bool): optional bool that if set refreshes the graph,
                otherwise the graph is pulled from the cache, if it exists.
                Defaults to False, meaning it pulls from the cache if it
                exists.

        Raises:
            ValueError: If the plugin doesn't exist or some issues came up
                during processing.
Initialize the graph from a cached plugin graph.
Initialize the graph from a cached plugin graph .
def from_plugin(self, plugin_name, plugin_config=None, refresh=False):
        """Initialize the graph from a cached plugin graph.

        Args:
            plugin_name (str): the name of the graph plugin to use.
            plugin_config (dict): optional dictionary to configure the plugin.
            refresh (bool): optional bool that if set refreshes the graph,
                otherwise the graph is pulled from the cache, if it exists.
                Defaults to False, meaning it pulls from the cache if it
                exists.

        Raises:
            ValueError: If the plugin doesn't exist or some issues came up
                during processing.
        """
        plugin_names = [x.get('name', '') for x in self.plugins]
        if plugin_name.lower() not in plugin_names:
            raise ValueError(
                f'Plugin [{plugin_name}] not part of the supported plugins.')

        if plugin_config and not isinstance(plugin_config, dict):
            raise ValueError('Plugin config needs to be a dict.')

        resource_url = f'{self.api.api_root}/sketches/{self._sketch.id}/graph/'
        data = {
            'plugin': plugin_name,
            'config': plugin_config,
            'refresh': bool(refresh),
        }

        if self.timelines:
            data['timeline_ids'] = self.timelines

        if plugin_config:
            if isinstance(plugin_config, str):
                self._graph_config = json.loads(plugin_config)
            else:
                self._graph_config = plugin_config

        response = self.api.session.post(resource_url, json=data)
        status = error.check_return_status(response, logger)
        if not status:
            error.error_message(
                response, 'Unable to retrieve cached graph', error=RuntimeError)

        response_json = error.get_response_json(response, logger)
        cache_dict = response_json.get('objects', [{}])[0]
        self._parse_graph_dict(cache_dict)
        self._description = f'Graph created from the {plugin_name} plugin.'
def from_plugin ( self , plugin_name , plugin_config = None , refresh = False ) : plugin_names = [ x . get ( 'name' , '' ) for x in self . plugins ] if plugin_name . lower ( ) not in plugin_names : raise ValueError ( f'Plugin [{plugin_name}] not part of the supported plugins.' ) if plugin_config and not isinstance ( plugin_config , dict ) : raise ValueError ( 'Plugin config needs to be a dict.' ) resource_url = f'{self.api.api_root}/sketches/{self._sketch.id}/graph/' data = { 'plugin' : plugin_name , 'config' : plugin_config , 'refresh' : bool ( refresh ) , } if self . timelines : data [ 'timeline_ids' ] = self . timelines if plugin_config : if isinstance ( plugin_config , str ) : self . _graph_config = json . loads ( plugin_config ) else : self . _graph_config = plugin_config response = self . api . session . post ( resource_url , json = data ) status = error . check_return_status ( response , logger ) if not status : error . error_message ( response , 'Unable to retrieve cached graph' , error = RuntimeError ) response_json = error . get_response_json ( response , logger ) cache_dict = response_json . get ( 'objects' , [ { } ] ) [ 0 ] self . _parse_graph_dict ( cache_dict ) self . _description = f'Graph created from the {plugin_name} plugin.'