Exemple #1
0
 def add_pilot_store(self, pilot_store):
     """ add PD to a certain pilot store 
         data will be moved into this store
     """
     if len(self.pilot_stores) > 0: # copy files from other pilot store
         self.pilot_stores[0].copy_pd(self, pilot_store)
     else: # copy files from original location
         pilot_store.put_pd(self)
     self.pilot_stores.append(pilot_store)
     CoordinationAdaptor.update_pd(self)  
Exemple #2
0
 def __init__(self, pilot_data_service=None, pilot_data_description=None, pd_url=None):
     """
         1.) create a new Pilot Data: pilot_data_service and pilot_data_description required
         2.) reconnect to an existing Pilot Data: pd_url required 
         
     """
     if pd_url==None:
         self.id = self.PD_ID_PREFIX + str(uuid.uuid1())
         self.pilot_data_description = pilot_data_description        
         self.pilot_stores=[]
         self.url = CoordinationAdaptor.add_pd(pilot_data_service.url, self)
         self.state = State.New
         self.data_units = DataUnit.create_data_unit_list(self, self.pilot_data_description["file_urls"]) 
         CoordinationAdaptor.update_pd(self)
     else:
         self.id = self.__get_pd_id(pd_url)
         self.url = pd_url            
         self.__restore_state()
Exemple #3
0
 def remove_data_unit(self, data_unit):
     self.data_units.remove(data_unit)
     CoordinationAdaptor.update_pd(self)
Exemple #4
0
 def add_data_unit(self, data_unit):
     self.data_units.append(data_unit)    
     CoordinationAdaptor.update_pd(self)
Exemple #5
0
 def cancel(self):
     """ Cancel the PD. """
     self.state = State.Done    
     CoordinationAdaptor.update_pd(self)
Exemple #6
0
 def update_state(self, state):
     self.state=state
     CoordinationAdaptor.update_pd(self)