def verify(doc): mng=XMLJobManager() slist=StoreList() llist=LocalStoreList() mng.registerPlugins() workflow=XMLWorkflow(doc.documentElement) for task in workflow.tasks: exc=getTaskExecutor(mng, task) if task.attributes.has_key("destStore"): store=llist.getByUuid(task.attributes["destStore"]) if store<>None: continue store=slist.getByUuid(task.attributes["destStore"]) if store==None: raise Exception("Unknown destination store") # oops, requested remote destination store and executor does not support it # change destination store to local one and add MOVE task after that if not exc.supportsRemoteDestination: task.element.setAttribute("destStore", task.attributes["srcStore"]) extra=doc.createElement("task") extra.setAttribute("guid", uuid4().get_hex()) extra.setAttribute("action", "MOVE") extra.setAttribute("srcStore", task.attributes["srcStore"]) if task.attributes.has_key("destAssetItem"): extra.setAttribute("srcAssetItem", task.attributes["destAssetItem"]) else: extra.setAttribute("srcAssetItem", task.attributes["srcAssetItem"]) extra.setAttribute("destStore", store.uuid) doc.documentElement.insertBefore(extra, task.element.nextSibling)
def main(): drop_privileges(Config.USER) setupLogging() with PIDLockFile(Config.CONFIGDIR+"/node.pid"): jman=XMLJobManager() jman.registerPlugins() queue=Queue(jman) linkthread=Thread(target=linkschecker) linkthread.daemon=True linkthread.start() # remove old interrupted tasks jman.unfinishedToError() queue.run()