本文整理汇总了Python中pilot.coordination.redis_adaptor.RedisCoordinationAdaptor.update_du方法的典型用法代码示例。如果您正苦于以下问题:Python RedisCoordinationAdaptor.update_du方法的具体用法?Python RedisCoordinationAdaptor.update_du怎么用?Python RedisCoordinationAdaptor.update_du使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pilot.coordination.redis_adaptor.RedisCoordinationAdaptor
的用法示例。
在下文中一共展示了RedisCoordinationAdaptor.update_du方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
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=[]
示例2: __add_pilot_data
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
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)
示例3: add_files
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
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)
示例4: __add_pilot_data
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
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)
示例5: _update_state
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
def _update_state(self, state):
""" Internal method for updating state"""
self.state=state
logger.debug("Update DU state to " + state + " Number of PD: " + str(len(self.pilot_data)))
if len(self.pilot_data) > 0:
CoordinationAdaptor.update_du(self)
示例6: remove_files
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
def remove_files(self, file_urls):
"""Remove files from Data Unit (NOT implemented yet"""
# TODO
#self.data_unit_items.remove(input_data_unit)
if len(self.pilot_data) > 0:
CoordinationAdaptor.update_du(self)
示例7: cancel
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
def cancel(self):
""" Cancel the Data Unit. """
self.state = State.Done
if len(self.pilot_data) > 0:
CoordinationAdaptor.update_du(self)
示例8: _update_state
# 需要导入模块: from pilot.coordination.redis_adaptor import RedisCoordinationAdaptor [as 别名]
# 或者: from pilot.coordination.redis_adaptor.RedisCoordinationAdaptor import update_du [as 别名]
def _update_state(self, state):
""" Internal method for updating state"""
self.state = state
if len(self.pilot_data) > 0:
CoordinationAdaptor.update_du(self)