本文整理汇总了Python中pilot.coordination.redis_adaptor.RedisCoordinationAdaptor类的典型用法代码示例。如果您正苦于以下问题:Python RedisCoordinationAdaptor类的具体用法?Python RedisCoordinationAdaptor怎么用?Python RedisCoordinationAdaptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RedisCoordinationAdaptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, cds_url=None):
""" Create a ComputeDataService (Decentral) object.
@param cds_url: Reconnect to an existing CDS (optional).
"""
# Pilot Data
self.data_units={}
self.pilot_data_services=[]
# Pilot Compute
self.compute_units={}
self.pilot_job_services=[]
if cds_url == None:
self.id=self.CDS_ID_PREFIX + str(uuid.uuid1())
application_url = CoordinationAdaptor.get_base_url(pilot.application_id)
self.url = CoordinationAdaptor.add_cds(application_url, self)
else:
self.id = self.__get_cds_id(cds_url)
self.url = cds_url
# Background Thread for scheduling
self.scheduler = Scheduler()
self.du_queue = Queue.Queue()
self.stop=threading.Event()
self.scheduler_thread=threading.Thread(target=self._scheduler_thread)
self.scheduler_thread.daemon=True
self.scheduler_thread.start()
logger.debug("Created ComputeDataServiceDecentral")
示例2: add_pilot_data_service
def add_pilot_data_service(self, pds):
""" Add a PilotDataService
@param pds: The PilotDataService to add.
"""
self.pilot_data_services.append(pds)
CoordinationAdaptor.update_cds(self.url, self)
示例3: put_du
def put_du(self, du):
"""Copy Data Unit to Pilot Data"""
logger.debug("Put DU: %s to Pilot-Data: %s"%(du.id,self.service_url))
self.__filemanager.create_du(du.id)
self.__filemanager.put_du(du)
self.data_unit_urls.append(du.get_url())
CoordinationAdaptor.update_pd(self)
示例4: __init__
def __init__(self, pilot_data=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.state = State.New
self.data_unit_items=[]
if self.data_unit_description.has_key("file_urls"):
self.data_unit_items = DataUnitItem.create_data_unit_list(self, self.data_unit_description["file_urls"])
self.url = None
# register a data unit as top-level entry in Redis
application_url = CoordinationAdaptor.get_base_url(application_id)
self.url = CoordinationAdaptor.add_du(application_url, self)
CoordinationAdaptor.update_du(self)
# Deprecated
# old method only allowed the creation of a du if a pd existed
#if pilot_data!=None:
# # Allow data units that are not connected to a resource!
# self.url = CoordinationAdaptor.add_du(pilot_data.url, self)
# CoordinationAdaptor.update_du(self)
else:
self.id = DataUnit._get_du_id(du_url)
self.url = du_url
logger.debug("Restore du: %s"%self.id)
self.__restore_state()
self.transfer_threads=[]
示例5: cancel
def cancel(self):
""" Cancel the CDS.
All associated PD and PC objects are canceled.
"""
# terminate background thread
self.stop.set()
CoordinationAdaptor.delete_cds(self.url)
示例6: submit_data_unit
def submit_data_unit(self, data_unit_description):
""" creates a data unit object and binds it to a physical resource (a pilotdata) """
du = DataUnit(pilot_data=None, data_unit_description=data_unit_description)
self.data_units[du.id] = du
self.du_queue.put(du)
# queue currently not persisted
CoordinationAdaptor.update_cds(self.url, self)
return du
示例7: add_pilot_compute_service
def add_pilot_compute_service(self, pcs):
""" Add a PilotComputeService to this CDS.
@param pcs: The PilotComputeService to which this ComputeDataService will connect.
"""
self.pilot_job_services.append(pcs)
CoordinationAdaptor.update_cds(self.url, self)
示例8: copy_du
def copy_du(self, du, pd_new):
""" Copy DataUnit to another Pilot Data """
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
pd_new.data_unit_urls.append(du.get_url())
CoordinationAdaptor.update_pd(pd_new)
示例9: __add_pilot_data
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)
self._update_state(State.Running)
#self.url = CoordinationAdaptor.add_du(pilot_data.url, self)
CoordinationAdaptor.update_du(self)
示例10: remove_pilot_compute_service
def remove_pilot_compute_service(self, pcs):
""" Remove a PilotJobService from this CDS.
Note that it won't cancel the PilotComputeService, it will just no
longer be connected to this CDS.
Keyword arguments:
@param pcs: The PilotComputeService to remove from this ComputeDataService.
"""
self.pilot_job_services.remove(pcs)
CoordinationAdaptor.update_cds(self.url, self)
示例11: add_pilot_compute_service
def add_pilot_compute_service(self, pcs):
""" Add a PilotComputeService to this CDS.
@param pcs: The PilotComputeService to which this ComputeDataService will connect.
"""
self.pilot_job_services.append(pcs)
CoordinationAdaptor.update_cds(self.url, self)
if len(self.pilot_job_services)>1:
logger.error("Decentral ComputeDataService only supports 1 PilotComputeService")
raise PilotError("Decentral ComputeDataService only supports 1 PilotComputeService")
示例12: submit_compute_unit
def submit_compute_unit(self, compute_unit_description):
""" Submit a CU to this Compute Data Service.
@param compute_unit_description: The ComputeUnitDescription from the application
@return: ComputeUnit object
"""
cu = ComputeUnit(compute_unit_description, self)
self.compute_units[cu.id]=cu
self.cu_queue.put(cu)
CoordinationAdaptor.update_cds(self.url, self)
return cu
示例13: add_files
def add_files(self, file_url_list=[]):
"""Add files referenced in list to Data Unit"""
self.state = State.Pending
item_list = DataUnitItem.create_data_unit_from_urls(None, file_url_list)
for i in item_list:
self.data_unit_items.append(i)
CoordinationAdaptor.update_du(self)
if len(self.pilot_data) > 0:
for i in self.pilot_data:
logger.debug("Update Pilot Data %s" % (i.get_url()))
i.put_du(self)
CoordinationAdaptor.update_du(self)
示例14: __add_pilot_data
def __add_pilot_data(self, pilot_data):
logger.debug("DU add_pilot_data: add DU to pilot data in Thread")
self._update_state(State.Pending)
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)
logger.debug("DU add_pilot_data: Copy/Put DU to pilot data successfull")
self.pilot_data.append(pilot_data)
self._update_state(State.Running)
logger.debug("DU add_pilot_data: Updated State")
#self.url = CoordinationAdaptor.add_du(pilot_data.url, self)
CoordinationAdaptor.update_du(self)
示例15: remove_pilot_compute_service
def remove_pilot_compute_service(self, pcs):
""" Remove a PilotJobService from this CDS.
Note that it won't cancel the PilotJobService, it will just no
longer be connected to this WUS.
Keyword arguments:
pilotjob_services -- The PilotJob Service(s) to remove from this
Work Unit Service.
Return:
Result
"""
self.pilot_job_services.remove(pcs)
CoordinationAdaptor.update_cds(self.url, self)
if len(self.pilot_job_services)>1:
logger.error("Decentral ComputeDataService only supports 1 PilotComputeService")
raise PilotError("Decentral ComputeDataService only supports 1 PilotComputeService")