Ejemplo n.º 1
0
 def snapshot(self, *args, **kwargs):
     req = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(target=self.remotePath +
                                                '.snapshot',
                                                args=args,
                                                kwargs=kwargs))
     return self.askServer(req)
Ejemplo n.º 2
0
 def call(self, target, *args, **kwargs):
     msg = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(
                                 target=target,
                                 args=args,
                                 kwargs=kwargs,
                             ))
     return self.ask(msg)
Ejemplo n.º 3
0
 def snapshot(self, instrument: str = None, *args, **kwargs):
     msg = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(
                                 target='snapshot' if instrument is None
                                 else f"{instrument}.snapshot",
                                 args=args,
                                 kwargs=kwargs,
                             ))
     return self.ask(msg)
Ejemplo n.º 4
0
 def getParamDict(self,
                  instrument: str = None,
                  attrs: List[str] = ['value'],
                  *args,
                  **kwargs):
     msg = ServerInstruction(operation=Operation.get_param_dict,
                             serialization_opts=ParameterSerializeSpec(
                                 path=instrument,
                                 attrs=attrs,
                                 args=args,
                                 kwargs=kwargs,
                             ))
     return self.ask(msg)
Ejemplo n.º 5
0
    def create_instrument(self, instrument_class: str, name: str, *args: Any,
                          **kwargs: Any) -> ProxyInstrumentModule:
        """ create a new instrument on the server and return a proxy for the new
        instrument.

        :param instrument_class: Class of the instrument to create or a string of
            of the class
        :param name: Name of the new instrument
        :param args: Positional arguments for new instrument instantiation
        :param kwargs: Keyword arguments for new instrument instantiation

        :returns: a new virtual instrument
        """
        req = ServerInstruction(operation=Operation.create_instrument,
                                create_instrument_spec=InstrumentCreationSpec(
                                    instrument_class=instrument_class,
                                    name=name,
                                    args=args,
                                    kwargs=kwargs))
        _ = self.ask(req)
        return ProxyInstrumentModule(name=name, cli=self, remotePath=name)
Ejemplo n.º 6
0
 def _getBluePrintFromServer(self, path):
     req = ServerInstruction(operation=Operation.get_blueprint,
                             requested_path=path)
     return self.askServer(req)
Ejemplo n.º 7
0
 def setParameters(self, parameters: Dict[str, Any]):
     msg = ServerInstruction(
         operation=Operation.set_params,
         set_parameters=parameters,
     )
     return self.ask(msg)
Ejemplo n.º 8
0
 def getBluePrint(self, path):
     msg = ServerInstruction(
         operation=Operation.get_blueprint,
         requested_path=path,
     )
     return self.ask(msg)
Ejemplo n.º 9
0
 def list_instruments(self) -> Dict[str, str]:
     """ Get the existing instruments on the server
     """
     msg = ServerInstruction(operation=Operation.get_existing_instruments)
     return self.ask(msg)
Ejemplo n.º 10
0
 def wrap(*a, **k):
     msg = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(target=bp.path,
                                                args=a,
                                                kwargs=k))
     return self.askServer(msg)
Ejemplo n.º 11
0
 def _remoteGet(self):
     msg = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(target=self.remotePath, ))
     return self.askServer(msg)
Ejemplo n.º 12
0
 def _remoteSet(self, value: Any):
     msg = ServerInstruction(operation=Operation.call,
                             call_spec=CallSpec(target=self.remotePath,
                                                args=(value, )))
     return self.askServer(msg)