Exemplo n.º 1
0
 def __send_init_request(self, workflow):
     if server_meet_version("3.0", self._server) \
             and isinstance(workflow, workflow_pb2.RemoteCopyRequest):
         request = workflow_pb2.CreateRequest()
         request.remote_copy.CopyFrom(workflow)
     else:
         request = base_pb2.Empty()
         if hasattr(workflow_pb2, "CreateRequest"):
             request = workflow_pb2.CreateRequest(empty=request)
     self._message = self._stub.Create(request)
Exemplo n.º 2
0
    def __init__(self, field_definition=None, server=None):
        if server is None:
            server = dpf.core._global_server()

        self._server = server
        self._stub = self._connect(self._server.channel)
        if isinstance(field_definition, field_definition_pb2.FieldDefinition):
            self._messageDefinition = field_definition
        else:
            request = base_pb2.Empty()
            self._messageDefinition = self._stub.Create(request)
Exemplo n.º 3
0
    def make_tmp_dir_server(self):
        """Create a temporary folder server side. Only one temporary folder can be created
        by server instance.
        The folder will be deleted when the server is stopped.

        Returns
        -------
        path : str
            path to the temporary dir
        """
        request = base_pb2.Empty()
        return self._stub.CreateTmpDir(request).server_file_path
Exemplo n.º 4
0
    def __init__(self, result_path=None, data_sources=None, server=None):
        """Initialize a connection with the server."""
        if server is None:
            server = dpf.core._global_server()

        self._server = server
        self._stub = self._connect()

        if data_sources is None:
            request = base_pb2.Empty()
            self._message = self._stub.Create(request)
        else:
            self._message = data_sources

        if result_path is not None:
            self.set_result_file_path(result_path)
Exemplo n.º 5
0
    def __init__(self, time_freq_support=None, server=None):
        """Initialize the TimeFreqSupport with its TimeFreqSupport message (if possible)."""
        if server is None:
            server = dpf.core._global_server()

        self._server = server
        self._stub = self._connect()
        if isinstance(time_freq_support,
                      time_freq_support_pb2.TimeFreqSupport):
            self._message = time_freq_support
        elif isinstance(time_freq_support, support_pb2.Support):
            self._message = time_freq_support_pb2.TimeFreqSupport()
            if isinstance(self._message.id, int):
                self._message.id = time_freq_support.id
            else:
                self._message.id.id = time_freq_support.id.id
        else:
            request = base_pb2.Empty()
            self._message = self._stub.Create(request)
Exemplo n.º 6
0
    def __init__(self, scoping=None, server=None, ids=None, location=None):
        """Initializes the scoping with an optional scoping message or
        by connecting to a stub.
        """
        if server is None:
            import ansys.dpf.core.server as serverlib

            server = serverlib._global_server()

        self._server = server
        self._stub = self._connect()

        if scoping is None:
            request = base_pb2.Empty()
            self._message = self._stub.Create(request)
        else:
            self._message = scoping

        if ids:
            self.ids = ids
        if location:
            self.location = location
Exemplo n.º 7
0
 def _prepare_shutdown(self):
     self._stub.PrepareShutdown(base_pb2.Empty())