def __init__(self, pilot_data_service=None, pilot_data_description=None, ps_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 ps_url==None and pilot_data_service!=None: # new ps self.id = self.PS_ID_PREFIX+str(uuid.uuid1()) self.pilot_data_description = pilot_data_description self.url = CoordinationAdaptor.add_ps(CoordinationAdaptor.get_base_url(bigdata.application_id)+"/"+pilot_data_service.id, self) elif ps_url != None: logger.warn("Reconnect to PilotData: %s"%ps_url) dictionary = CoordinationAdaptor.get_ps(ps_url) ps_dict = dictionary["pilot_data"] for i in ps_dict: self.__setattr__(i, ps_dict[i]) self.initialize_pilot_data()
def create_pilot(self, pilot_data_description): """ Create a PilotData Keyword arguments: pilot_data_description -- PilotData Description { 'service_url': "ssh://<hostname>/base-url/" 'size': "1000" } Return value: A PilotData handle """ ps = PilotData(pilot_data_service=self, pilot_data_description=pilot_data_description) self.pilot_data[ps.id]=ps # store pilot store in central data space CoordinationAdaptor.add_ps(self.url, ps) return ps