示例#1
0
def request_server_command_defs(server):
    logger.info("Requesting available commands from server")
    from trustedanalytics.core.errorhandle import IaError
    try:
        return server.get("/commands/definitions")
    except:
        import sys
        sys.stderr.write('Unable to connect to server %s\n' % server._get_base_uri())
        raise IaError(logger)
示例#2
0
    def execute_in_api_context(function, *args, **kwargs):
        with api_context(logger, depth, function, *args, **kwargs):
            try:
                verify_api_installed()
                return function(*args, **kwargs)
            except:
                error = IaError(exec_logger)

                raise error  # see trustedanalytics.errors.last for python details
示例#3
0
 def __init__(self, name=None, _info=None):
     """Initialize the graph."""
     try:
         self.uri = None
         if not hasattr(self, '_backend'):
             self._backend = _get_backend()
         _BaseGraph.__init__(self)
         self.uri = self._backend.create(self, name, 'hbase/titan', _info)
         # logger.info('Created new graph "%s"', new_graph_name)
     except:
         raise IaError(logger)
示例#4
0
    def __init__(self, name=None, _info=None):
        """Initialize the graph.

    Examples
    --------
    Starting with a ta.Graph you can export to Titan to take advantage of Gremlin query.

    .. code::

        >>> graph = ta.get_graph("my_graph")
        >>> titan_graph = graph.export_to_titan("titan_graph")

</skip>
    """
        try:
            self.uri = None
            if not hasattr(self, '_backend'):
                self._backend = _get_backend()
            _BaseGraph.__init__(self)
            self.uri = self._backend.create(self, name, 'hbase/titan', _info)
            # logger.info('Created new graph "%s"', new_graph_name)
        except:
            raise IaError(logger)
示例#5
0
    def __exit__(self, exception_type, exception_value, traceback):
        self.call_stack.dec()
        if exception_value:
            error = IaError(self.logger)

            raise error  # see trustedanalytics.errors.last for details