Example #1
0
 def list_instances(self, offset: int = 0, limit: Optional[int] = None,
                    with_info: bool = False) -> List[GraphInstanceInfo]:
     """List all known graph instances.
        If with_info is false, only instance_id will be received.
     :returns List[GraphInstanceInfo]: List of received graph instances
     """
     data = {offset: offset, with_info: '1' if with_info else '0'}
     if limit is not None:
         data['limit'] = limit
     return [GraphInstanceInfo.create(_)
             for _ in requests.get(self._url_prefix + 'instances', params=data).json()['payload']]
Example #2
0
 def list_graph_instance_info(self, with_info: bool = False) -> Iterator[Tuple[str, Optional[GraphInstanceInfo]]]:
     for instance_id, instance_info in self.instances.iterate_all(include_value=with_info):
         yield instance_id, GraphInstanceInfo.create(instance_info) if instance_info else None
Example #3
0
 def read_graph_instance_info(self, instance_id: str) -> GraphInstanceInfo:
     return GraphInstanceInfo.create(self.instances.get(instance_id))
Example #4
0
 def read_instance(self, instance_id: str) -> GraphInstanceInfo:
     """Read info about a specified graph's instance.
     :returns GraphInstanceInfo: info about a graph's instance
     """
     return GraphInstanceInfo.create(requests.get(self._get_instance_url(instance_id)).json()['payload'])