Beispiel #1
0
 def __add_pilot_data(self, pilot_data):
     logger.debug("add du to pilot data")
     if len(self.pilot_data) > 0: # copy files from other pilot data
         self.pilot_data[0].copy_du(self, pilot_data)
     else: # copy files from original location
         pilot_data.put_du(self)
     self.pilot_data.append(pilot_data)
     CoordinationAdaptor.update_du(self)  
Beispiel #2
0
 def __init__(self, pilot_data_service=None, data_unit_description=None, du_url=None):
     """
         1.) create a new Pilot Data: pilot_data_service and data_unit_description required
         2.) reconnect to an existing Pilot Data: du_url required 
         
     """
     if du_url==None:
         self.id = self.DU_ID_PREFIX + str(uuid.uuid1())
         self.data_unit_description = data_unit_description        
         self.pilot_data=[]
         self.url = CoordinationAdaptor.add_du(pilot_data_service.url, self)
         self.state = State.New
         self.data_unit_items = DataUnitItem.create_data_unit_list(self, self.data_unit_description["file_urls"]) 
         CoordinationAdaptor.update_du(self)
     else:
         self.id = self.__get_du_id(du_url)
         self.url = du_url   
         logger.debug("Restore du: %s"%self.id)         
         self.__restore_state()
         
     self.transfer_threads=[]
Beispiel #3
0
 def update_state(self, state):
     self.state=state
     CoordinationAdaptor.update_du(self)
Beispiel #4
0
 def remove_data_unit(self, data_unit):
     self.data_unit_items.remove(data_unit)
     CoordinationAdaptor.update_du(self)
Beispiel #5
0
 def add_data_unit(self, data_unit):
     self.data_unit_items.append(data_unit)    
     CoordinationAdaptor.update_du(self)
Beispiel #6
0
 def cancel(self):
     """ Cancel the DU. """
     self.state = State.Done    
     CoordinationAdaptor.update_du(self)