Ejemplo n.º 1
0
 def put_du(self, du):
     """Copy Data Unit to Pilot Data"""
     logger.debug("Put DU: %s to Pilot-Data: %s"%(du.id,self.service_url))
     self.__filemanager.create_du(du.id)
     self.__filemanager.put_du(du)
     self.data_unit_urls.append(du.get_url())
     CoordinationAdaptor.update_pd(self)
Ejemplo n.º 2
0
 def put_du(self, du):
     """Copy Data Unit to Pilot Data"""
     logger.debug("Put DU: %s to Pilot-Data: %s" %
                  (du.id, self.service_url))
     self.__filemanager.create_du(du.id)
     self.__filemanager.put_du(du)
     self.data_unit_urls.append(du.get_url())
     CoordinationAdaptor.update_pd(self)
Ejemplo n.º 3
0
 def copy_du(self, du, pd_new):
     """ Copy DataUnit to another Pilot Data """
     pd_new.create_du(du)
     self.__filemanager.copy_du(du, pd_new)
     
     # update meta data at pd_new
     #pd_new.data_units[du.id] = du
     pd_new.data_unit_urls.append(du.get_url())
     CoordinationAdaptor.update_pd(pd_new)
Ejemplo n.º 4
0
    def copy_du(self, du, pd_new):
        """ Copy DataUnit to another Pilot Data """
        pd_new.create_du(du)
        self.__filemanager.copy_du(du, pd_new)

        # update meta data at pd_new
        #pd_new.data_units[du.id] = du
        pd_new.data_unit_urls.append(du.get_url())
        CoordinationAdaptor.update_pd(pd_new)
Ejemplo n.º 5
0
    def __init__(self,
                 pilot_data_service=None,
                 pilot_data_description=None,
                 pd_url=None):
        """ 
            Initialize PilotData at given service url::
            
                ssh://<hostname>
                gsissh://<hostname>
                go://<hostname>
                gs://google.com
                s3://aws.amazon.com
            
            In the future more SAGA/Bliss URL schemes/adaptors are supported.        
        """
        self.id = None
        self.url = pd_url
        self.pilot_data_description = None
        self.pilot_data_service = pilot_data_service
        self.service_url = None
        self.size = None
        self.data_unit_urls = []
        self.security_context = None

        if pd_url == None and pilot_data_service != None:  # new pd
            self.id = self.PD_ID_PREFIX + str(uuid.uuid1())
            self.pilot_data_description = pilot_data_description
            self.url = CoordinationAdaptor.add_pd(
                CoordinationAdaptor.get_base_url(application_id) + ":" +
                pilot_data_service.id, self)
        elif pd_url != None:
            logger.warn("Reconnect to PilotData: %s" % pd_url)
            dictionary = CoordinationAdaptor.get_pd(pd_url)
            if dictionary.has_key("security_context"):
                self.security_context = dictionary["security_context"]
            pd_dict = eval(dictionary["pilot_data"])
            for i in pd_dict:
                self.__setattr__(i, pd_dict[i])
            # A Pilot Data does not hold a direct reference to a Data Unit (only URL refs are stored)
            self.data_unit_urls = eval(dictionary["data_unit_urls"])

        self.__initialize_pilot_data()
        CoordinationAdaptor.update_pd(self)
Ejemplo n.º 6
0
    def __init__(self, pilot_data_service=None, pilot_data_description=None, pd_url=None):
        """ 
            Initialize PilotData at given service url::
            
                ssh://<hostname>
                gsissh://<hostname>
                go://<hostname>
                gs://google.com
                s3://aws.amazon.com
            
            In the future more SAGA/Bliss URL schemes/adaptors are supported.        
        """
        self.id = None
        self.url = pd_url
        self.pilot_data_description = None
        self.pilot_data_service = pilot_data_service
        self.service_url = None
        self.size = None
        self.data_unit_urls = []
        self.security_context = None

        if pd_url == None and pilot_data_service != None:  # new pd
            self.id = self.PD_ID_PREFIX + str(uuid.uuid1())
            self.pilot_data_description = pilot_data_description
            self.url = CoordinationAdaptor.add_pd(
                CoordinationAdaptor.get_base_url(application_id) + ":" + pilot_data_service.id, self
            )
        elif pd_url != None:
            logger.warn("Reconnect to PilotData: %s" % pd_url)
            dictionary = CoordinationAdaptor.get_pd(pd_url)
            if dictionary.has_key("security_context"):
                self.security_context = dictionary["security_context"]
            pd_dict = eval(dictionary["pilot_data"])
            for i in pd_dict:
                self.__setattr__(i, pd_dict[i])
            # A Pilot Data does not hold a direct reference to a Data Unit (only URL refs are stored)
            self.data_unit_urls = eval(dictionary["data_unit_urls"])

        self.__initialize_pilot_data()
        CoordinationAdaptor.update_pd(self)
Ejemplo n.º 7
0
 def remove_du(self, du):
     """ Remove Data Unit from Pilot Data """
     if self.data_unit_urls.count(du.get_url())>0:
         self.__filemanager.remove_du(du)
         self.data_unit_urls.remove(du.get_url())
     CoordinationAdaptor.update_pd(self)
Ejemplo n.º 8
0
 def remove_du(self, du):
     """ Remove Data Unit from Pilot Data """
     if self.data_unit_urls.count(du.get_url()) > 0:
         self.__filemanager.remove_du(du)
         self.data_unit_urls.remove(du.get_url())
     CoordinationAdaptor.update_pd(self)