Beispiel #1
0
 def get_transport_class(self):
     try:
         # I return the class, not an instance
         return TransportFactory(self.get_transport_type())
     except MissingPluginError as e:
         raise ConfigurationError('No transport found for {} [type {}], message: {}'.format(
             self.name, self.get_transport_type(), e.message))
 def test_existing_transports(self):
     """
     Test listing all preinstalled transports
     """
     transports = all_plugins('transports')
     self.assertIsInstance(transports, list)
     for i in transports:
         self.assertTrue(issubclass(TransportFactory(i), Transport))
    def test_existing_transports(self):
        """
        Test listing all preinstalled transports
        """
        entry_points = get_entry_points('aiida.transports')
        self.assertIsInstance(entry_points, list)

        for entry_point in entry_points:
            cls = TransportFactory(entry_point.name)
            self.assertTrue(issubclass(cls, Transport),
                'Transport plugin class {} is not subclass of {}'.format(cls, Transport))
 def test_existing_transports(self):
     """
     Test listing all preinstalled transports
     """
     transports = all_plugins('transports')
     self.assertIsInstance(transports, list)
     for i in transports:
         cls = TransportFactory(i)
         self.assertTrue(
             issubclass(cls, Transport),
             'Transport plugin class {} is not subclass of {}'.format(
                 cls, Transport))
Beispiel #5
0
    def get_transport(self):
        """
        Return a configured transport to connect to the computer.
        """
        computer = self.computer
        try:
            ThisTransport = TransportFactory(computer.get_transport_type())
        except MissingPluginError as e:
            raise ConfigurationError(
                'No transport found for {} [type {}], message: {}'.format(
                    computer.hostname, computer.get_transport_type(),
                    e.message))

        params = dict(computer.get_transport_params().items() +
                      self.get_auth_params().items())
        return ThisTransport(machine=computer.hostname, **params)
Beispiel #6
0
    def get_transport(self):
        """
        Given a computer and an aiida user (as entries of the DB) return a configured
        transport to connect to the computer.
        """
        from aiida.orm.computer import Computer
        try:
            ThisTransport = TransportFactory(self.dbcomputer.transport_type)
        except MissingPluginError as e:
            raise ConfigurationError(
                'No transport found for {} [type {}], message: {}'.format(
                    self.dbcomputer.hostname, self.dbcomputer.transport_type,
                    e.message))

        params = dict(
            Computer(
                dbcomputer=self.dbcomputer).get_transport_params().items() +
            self.get_auth_params().items())
        return ThisTransport(machine=self.dbcomputer.hostname, **params)
Beispiel #7
0
def list_transport_options(transport_type):
    from aiida.transport import TransportFactory
    options_list = [create_option(*item) for item in TransportFactory(transport_type).auth_options.items()]
    return options_list