def copy_du(self, du, pd_new): 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 CoordinationAdaptor.update_pd(pd_new)
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)
def __init__(self, pilot_data_service=None, data_unit_description=None, pd_url=None): """ 1.) create a new Pilot Data: pilot_data_service and data_unit_description required 2.) reconnect to an existing Pilot Data: pd_url required """ if pd_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_pd(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_pd(self) else: self.id = self.__get_pd_id(pd_url) self.url = pd_url self.__restore_state()
def remove_du(self, du): """ Remove pilot data from pilot data """ if self.data_units.has_key(du.id): self.__filemanager.remove_du(du) del self.data_units[du.id] CoordinationAdaptor.update_pd(self)
def put_du(self, du): logging.debug("Put PD: %s to PS: %s"%(du.id,self.service_url)) self.__filemanager.create_du(du.id) self.__filemanager.put_du(du) self.data_units[du.id] = du CoordinationAdaptor.update_pd(self)
def update_state(self, state): self.state=state CoordinationAdaptor.update_pd(self)
def remove_data_unit(self, data_unit): self.data_unit_items.remove(data_unit) CoordinationAdaptor.update_pd(self)
def add_data_unit(self, data_unit): self.data_unit_items.append(data_unit) CoordinationAdaptor.update_pd(self)
def cancel(self): """ Cancel the PD. """ self.state = State.Done CoordinationAdaptor.update_pd(self)