Exemplo n.º 1
0
    def __init__(self, url, session=None):
        '''Construct a new directory object

           @param url: Url of the (remote) file system.
           @type  url: L{Url} 

           The specified directory is expected to exist -- otherwise
           a DoesNotExist exception is raised.  Also, the URL must point to
           a directory (not to a file), otherwise a BadParameter exception is
           raised.

           Example::

               # open some directory
               dir = saga.filesystem.Directory("sftp://localhost/tmp/")

               # and list its contents
               files = dir.list ()

        '''
        #Object.__init__(self, Object.Type.LogicalFileDirectory, 
        #                apitype=Object.Type.LogicalFileAPI, session=session)
        Object.__init__(self, session=session)
        self._apitype="saga.logicalfile"

        if(type(url) == str):
            self._url = Url(str(url))
        else:
            self._url = url

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_logicaldirectory_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 2
0
    def __init__(self, url, session=None):
        '''Construct a new job service object
           @param url: Url of the (remote) job manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.job'

        if type(url) == str:
            self._url = Url(str(url))
        elif type(url) == Url:
            self._url = url
        elif type(url) == Compute:
            self._url = url._url
        else:
            raise bliss.saga.Exception(bliss.saga.Error.BadParameter, 
             "A job.Service object must either be initialized with a URL or a resource.Compute object.")


        self._from_compute = False
        self._compute_obj = None

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_service_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 3
0
    def __init__(self, url, session=None):
        '''Construct a new job service object
           @param url: Url of the (remote) job manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.job'

        if type(url) == str:
            self._url = Url(str(url))
        elif type(url) == Url:
            self._url = url
        elif type(url) == Compute:
            self._url = url._url
        else:
            raise bliss.saga.Exception(
                bliss.saga.Error.BadParameter,
                "A job.Service object must either be initialized with a URL or a resource.Compute object."
            )

        self._from_compute = False
        self._compute_obj = None

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._plugin.register_service_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 4
0
Arquivo: Job.py Projeto: ashleyz/bliss
    def __init_from_service(self, service_obj, job_desc):
        '''Constructor'''
        self._service = service_obj
        self._url = service_obj._url
        self._job_description = job_desc

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 5
0
    def __init_from_manager(self, manager_obj, storage_description):
        '''(Hidden) Constructor'''
        self._manager = manager_obj
        self._url = manager_obj._url
        self._storage_description = storage_description

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 6
0
    def __init_from_manager(self, manager_obj, compute_description):
        '''(Hidden) Constructor'''
        self._manager = manager_obj
        self._url     = manager_obj._url
        self._compute_description = compute_description

        self._plugin  = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 7
0
    def __init_from_service(self, service_obj, job_desc):
        '''Constructor'''
        self._service = service_obj
        self._url = service_obj._url
        self._job_description = job_desc

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 8
0
    def __init__(self, url, session=None):
        '''Construct a new resource manager object
           @param url: Url of the (remote) resource manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, Object.Type.ResourceManager, 
                        apitype=Object.Type.ResourceAPI, session=session)

        if(type(url) == str):
            self._url = Url(str(url))
        else:
            self._url = url

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_manager_object(self, url)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 9
0
    def __init__(self, url, session=None):
        '''Construct a new file object
           @param url: Url of the (remote) job manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, Object.Type.FilesystemDirectory, 
                        apitype=Object.Type.FilesystemAPI, session=session)

        if(type(url) == str):
            self._url = Url(str(url))
        else:
            self._url = url

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_directory_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 10
0
    def __init__(self, url, flags=None, session=None):
        '''Construct a new directory object

           @param url: Url of the (remote) file system.
           @type  url: L{Url} 

           The specified directory is expected to exist -- otherwise
           a DoesNotExist exception is raised.  Also, the URL must point to
           a directory (not to a file), otherwise a BadParameter exception is
           raised.

           Example::

               # open some directory
               dir = saga.filesystem.Directory("sftp://localhost/tmp/")

               # and list its contents
               files = dir.list ()

        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.filesystem'

        if type(url) == str:
            self._url = bliss.saga.Url(str(url))
        elif type(url) == bliss.saga.Url:
            self._url = url
        else:
            raise bliss.saga.Exception(
                bliss.saga.Error.NoSuccess,
                "File constructor expects str or bliss.saga.Url type as 'url' parameter"
            )

        # Directory paths end with "/" by convention
        if self._url.path.endswith("/") != True:
            self._url.path = "%s/" % self._url.path

        if flags is None:
            _flags = 0
        else:
            _flags = flags

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._plugin.register_directory_object(self, _flags)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 11
0
    def __init__(self, url, flags=None, session=None):
        '''Construct a new directory object

           @param url: Url of the (remote) file system.
           @type  url: L{Url} 

           The specified directory is expected to exist -- otherwise
           a DoesNotExist exception is raised.  Also, the URL must point to
           a directory (not to a file), otherwise a BadParameter exception is
           raised.

           Example::

               # open some directory
               dir = saga.filesystem.Directory("sftp://localhost/tmp/")

               # and list its contents
               files = dir.list ()

        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.filesystem'


        if type(url) == str:
            self._url = bliss.saga.Url(str(url))
        elif type(url) == bliss.saga.Url:
            self._url = url
        else:
            raise bliss.saga.Exception(bliss.saga.Error.NoSuccess,
              "File constructor expects str or bliss.saga.Url type as 'url' parameter")

        # Directory paths end with "/" by convention
        if self._url.path.endswith("/") != True :
            self._url.path = "%s/" % self._url.path

        if flags is None:
            _flags = 0
        else:
            _flags = flags

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_directory_object(self, _flags)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 12
0
    def __init__(self, url, session=None):
        '''Construct a new job service object
           @param url: Url of the (remote) job manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, Object.Type.JobService, 
                            apitype=Object.Type.JobAPI, session=session)

        if(type(url) == str):
            self._url = Url(str(url))
        else:
            self._url = url

        self._from_compute = False
        self._compute_obj = None

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_service_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 13
0
Arquivo: File.py Projeto: melrom/bliss
    def __init__(self, url, session=None):
        """Construct a new file object
           @param url: Url of the (remote) job manager.
           @type  url: L{Url} 
        """
        Object.__init__(self, Object.Type.FilesystemFile, apitype=Object.Type.FilesystemAPI, session=session)

        if type(url) == str:
            self._url = bliss.saga.Url(str(url))
        elif type(url) == bliss.saga.Url:
            self._url = url
        else:
            raise bliss.saga.Exception(
                bliss.saga.Error.NoSuccess, "File constructor expects str or bliss.saga.Url type as 'url' parameter"
            )

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._plugin.register_file_object(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 14
0
    def __init__(self, url, session=None):
        '''Construct a new resource manager object
           @param url: Url of the (remote) resource manager.
           @type  url: L{Url} 
        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.resource'

        if type(url) == str:
            self._url = Url(str(url))
        elif type(url) == Url:
            self._url = url
        else:
            raise bliss.saga.Exception(bliss.saga.Error.BadParameter, 
             "A resource.Manager object must be initialized with a URL.")


        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_manager_object(self, self._url)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 15
0
    def __init__(self, service):
        '''Create a new job (a.k.a. 'task') container.

           @param service: Currently, a container needs to be bound to
                           a valid L{saga.job.Service} and can only hold 
                           jobs that are known to that service.  
        '''
        Object.__init__(self, Object.Type.JobContainer, apitype=Object.Type.JobAPI)
        
        # parameter checks
        if service.get_type() != Object.Type.JobService:
            raise bliss.saga.Exception(bliss.saga.Error.BadParameter, 
                  "Container c'tor expects %s object as parameter" 
                  % (Object.Type.JobService))
      
        self._service = service
        self._url = service._url
        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.container_object_register(self)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 16
0
    def __init__(self, url, flags=None, session=None):
        '''Construct a new file object

           @param url: Url of the (remote) file
           @type  url: L{Url} 

           The specified file is expected to exist -- otherwise a DoesNotExist
           exception is raised.  Also, the URL must point to a file (not to
           a directory), otherwise a BadParameter exception is raised.

           Example::

               # get a file handle
               file = saga.filesystem.File("sftp://localhost/tmp/data/data.bin")
    
               # print the file's size
               print file.get_size ()

        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.filesystem'

        if type(url) == str:
            self._url = bliss.saga.Url(str(url))
        elif type(url) == bliss.saga.Url:
            self._url = url
        else:
            raise bliss.saga.Exception(
                bliss.saga.Error.NoSuccess,
                "File constructor expects str or bliss.saga.Url type as 'url' parameter"
            )

        if flags is None:
            _flags = 0
        else:
            _flags = flags

        self._plugin = Object._get_plugin(self)  # throws 'NoSuccess' on error
        self._plugin.register_file_object(self, flags)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))
Exemplo n.º 17
0
    def __init__(self, url, flags=None, session=None):
        '''Construct a new file object

           @param url: Url of the (remote) file
           @type  url: L{Url} 

           The specified file is expected to exist -- otherwise a DoesNotExist
           exception is raised.  Also, the URL must point to a file (not to
           a directory), otherwise a BadParameter exception is raised.

           Example::

               # get a file handle
               file = saga.filesystem.File("sftp://localhost/tmp/data/data.bin")
    
               # print the file's size
               print file.get_size ()

        '''
        Object.__init__(self, session=session)
        self._apitype = 'saga.filesystem'

        if type(url) == str:
            self._url = bliss.saga.Url(str(url))
        elif type(url) == bliss.saga.Url:
            self._url = url
        else:
            raise bliss.saga.Exception(bliss.saga.Error.NoSuccess,
              "File constructor expects str or bliss.saga.Url type as 'url' parameter")

        if flags is None:
            _flags = 0
        else:
            _flags = flags

        self._plugin = Object._get_plugin(self) # throws 'NoSuccess' on error
        self._plugin.register_file_object(self, flags)
        self._logger.info("Bound to plugin %s" % (repr(self._plugin)))