Exemple #1
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>
         
         Currently only ssh schemes are supported. In the future all 
         SAGA URL schemes/adaptors should be supported.        
     """ 
     self.id = None
     self.url = None
     self.pilot_data_description = None
     self.service_url=None
     self.size = None
     self.data_unit_description = None
     self.data_units={}
     
     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)
         pd_dict = dictionary["pilot_data"]
         for i in pd_dict:
             self.__setattr__(i, pd_dict[i])
                     
     self.initialize_pilot_data()
Exemple #2
0
 def __restore_state(self):
     pd_dict = CoordinationAdaptor.get_pd(self.url)
     self.data_unit_description = pd_dict["data_unit_description"]
     self.state = pd_dict["state"]
     data_unit_dict_list = pd_dict["data_units"]
     self.data_unit_items = [DataUnitItem.create_data_unit_from_dict(i) for i in data_unit_dict_list]
     self.pilot_stores = [] 
     for i in pd_dict["pilot_stores"]:
         logger.debug("PS:"+str(i)) 
         ps = PilotData(ps_url=str(i))
         self.pilot_stores.append(ps)